How to adjust the text field size in Edit or Create form

280 views
Skip to first unread message

Roy

unread,
Feb 26, 2009, 10:54:04 PM2/26/09
to ActiveScaffold : Ruby on Rails plugin
How to adjust the text field size in Edit or Create form, I want to
enlarge the field size.

Thanks

David Cato

unread,
Feb 27, 2009, 12:00:25 AM2/27/09
to Roy, ActiveScaffold : Ruby on Rails plugin
Roy wrote ...

> How to adjust the text field size in Edit or Create form, I want to
> enlarge the field size.

Specify something like the following in your controller:

config.columns[:textfield_name].options = { :size => 80 }
config.columns[:textarea_name].options = { :cols => 60, :rows => 10 }

Roy

unread,
Mar 2, 2009, 2:48:46 AM3/2/09
to ActiveScaffold : Ruby on Rails plugin
Hi David,

When I add "config.columns[:textfield_name].options = { :size => 80 }"
in my code.

The text field size is not change. It is still 20.

David Cato

unread,
Mar 2, 2009, 12:25:37 PM3/2/09
to Roy, ActiveScaffold : Ruby on Rails plugin
Roy wrote ...

> When I add "config.columns[:textfield_name].options = { :size => 80 }"
> in my code.
>
> The text field size is not change. It is still 20.

Are you using a helper or partial override for the column? If so, you
need to make the change in the override. If not, then is the column a
real or virtual column? It looks like column options are not merged for
virtual columns.

Sri Sri

unread,
Mar 3, 2009, 2:45:50 PM3/3/09
to actives...@googlegroups.com
I had a similar issue with the earlier version of rails. I simply removed the textarea's width from the .css file.

Roy

unread,
Mar 3, 2009, 11:37:36 PM3/3/09
to ActiveScaffold : Ruby on Rails plugin
Hi David,

It is a real column, and I am not override it in helper.

Hi Sri Sri,

I am not find the set width in .css file. I just find some font size
and format setting.

Ruby 1.8.6
Rails 2.0.2
Active Scaffold 1.1.1

Many thank both

David Cato

unread,
Mar 4, 2009, 1:04:14 AM3/4/09
to Roy, ActiveScaffold : Ruby on Rails plugin
Roy wrote ...

> It is a real column, and I am not override it in helper.
>
> Hi Sri Sri,
>
> I am not find the set width in .css file. I just find some font size
> and format setting.
>
> Ruby 1.8.6
> Rails 2.0.2
> Active Scaffold 1.1.1

Looking at the diffs between 1.1.1 and later versions it looks like
you'll likely need to modify lib/helpers/form_column_helpers.rb to get
the expected behavior.

Look at #active_scaffold_input_text_options and delete the line that
hard-sets the size to 20:

options[:size] = 20

That line is not even in later versions of form_column_helpers and it
does not look to me like it needs to be in the 1.1.1 version either, but
I could be wrong. You could always change '=' to '||=' if you wanted to
be really safe.

Roy

unread,
Mar 4, 2009, 10:50:54 PM3/4/09
to ActiveScaffold : Ruby on Rails plugin
I can change the text field size when I modify the code in lib/helpers/
form_column_helpers.rb, but the helper can't get the size value that I
had set in controller.

When I print the "options" in helper:

autocompleteoffclassename-inputnamerecord[ename]idrecord_ename_1

I can't see the size value that I had set in controller.

Thanks
Reply all
Reply to author
Forward
0 new messages