Define size of text_field_with_auto_complete

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!

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

Craig

That doesn’t work with auto_complete though. I know how to do it for
a text_field. :slight_smile:

<%= 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.

That’s working thank you!

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

<%= text_field_with_auto_complete :agency, :city, {:size => 50} %>

Craig

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs