# Define size of text\_field\_with\_auto\_complete

**URL:** <https://www.ruby-forum.com/t/define-size-of-text-field-with-auto-complete/133346>\
**Category:** Rails\
**Created:** [March 30, 2008, 3:59pm UTC](https://www.ruby-forum.com/t/define-size-of-text-field-with-auto-complete/133346 "2008-03-30T15:59:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ncancelliere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9f8e36/32.png) [@ncancelliere](https://www.ruby-forum.com/u/ncancelliere)\
**Post date:** [March 30, 2008, 3:59pm UTC](https://www.ruby-forum.com/t/define-size-of-text-field-with-auto-complete/133346/1 "2008-03-30T15:59:07Z")

</div>

I am using the auto\_complete plugin to help out in some of my forms in  
Rails 2.0. The issue I’m having is trying to get the text field size  
to be more than 30 in width in the display.

It seems to be taking the default attribute of a form\_for.text\_field  
object, and I don’t know how to override it. The only options you can  
pass to it are the model and field and optional limit to the amount of  
items returned.

If anyone has some advice I’d greatly appreciate it, thanks!

---

<div class="post-metadata">

**Author:** ![ncancelliere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9f8e36/32.png) [@ncancelliere](https://www.ruby-forum.com/u/ncancelliere)\
**Post date:** [March 30, 2008, 5:11pm UTC](https://www.ruby-forum.com/t/define-size-of-text-field-with-auto-complete/133346/2 "2008-03-30T17:11:18Z")

</div>

On Sun, 2008-03-30 at 06:58 -0700, ncancelliere wrote:

> I am using the auto\_complete plugin to help out in some of my forms in  
> Rails 2.0. The issue I’m having is trying to get the text field size  
> to be more than 30 in width in the display.
> 
> It seems to be taking the default attribute of a form\_for.text\_field  
> object, and I don’t know how to override it. The only options you can  
> pass to it are the model and field and optional limit to the amount of  
> items returned.
> 
> If anyone has some advice I’d greatly appreciate it, thanks!

* * *

\<%= text\_field ‘some\_model’ ‘some\_field’, :size =\> ‘64’ %\>

[http://rails.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M000923](http://rails.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M000923)

Craig

---

<div class="post-metadata">

**Author:** ![ncancelliere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9f8e36/32.png) [@ncancelliere](https://www.ruby-forum.com/u/ncancelliere)\
**Post date:** [March 31, 2008, 4:26am UTC](https://www.ruby-forum.com/t/define-size-of-text-field-with-auto-complete/133346/3 "2008-03-31T04:26:45Z")

</div>

That doesn’t work with auto\_complete though. I know how to do it for  
a text\_field. 🙂

```
<%= text_field_with_auto_complete :agency, :city, :size => 50 %>

```

–still renders the input field as 30 characters long. It seems to be  
using the default (30) settings from the text\_filed formhelper, but  
specifying them doesn’t seem to override them.

My post was saying how I can’t get it to do anything for the  
autocomplete fields.

---

<div class="post-metadata">

**Author:** ![ncancelliere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9f8e36/32.png) [@ncancelliere](https://www.ruby-forum.com/u/ncancelliere)\
**Post date:** [April 1, 2008, 4:22am UTC](https://www.ruby-forum.com/t/define-size-of-text-field-with-auto-complete/133346/4 "2008-04-01T04:22:23Z")

</div>

That’s working thank you!

---

<div class="post-metadata">

**Author:** ![ncancelliere](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9f8e36/32.png) [@ncancelliere](https://www.ruby-forum.com/u/ncancelliere)\
**Post date:** [March 31, 2008, 4:35am UTC](https://www.ruby-forum.com/t/define-size-of-text-field-with-auto-complete/133346/5 "2008-03-31T04:35:32Z")

</div>

try this (I’m not gonna fire up rails at the moment)

\<%= text\_field\_with\_auto\_complete :agency, :city, {:size =\> 50} %\>

Craig
