Isn't there a DRYer way for "size"= ?

Hi Shauna,

Shauna wrote:

What's the difference between size and
maxlength in a view file?

'Size' has to do with the visible size (sorry about that) of the form field. For example, if you set size = 5, the width of a text field will be 5 characters (as measured by the size of the text on the form, not necessarily of the text you'll enter into the field which will typically be a smaller size than the font on the form). Size has nothing at all to do with how many characters you can enter into the field. Maxlength sets the number of characters that can be entered into a field. Size is an HTML attribute. Maxlength is, I believe, a javascript attribute (although I'd be surprised if 'attribute' is the right word there).


"maxlength" is also html.

Shauna wrote:
I am already using the

enforce_column_limits in my models, which means I can skip maxlength now
that I know what it does.

I have been using maxlength in my forms too. I wasnt aware of
enforce_column, probably best to use this, but even so, if you dont set
maxlength in the form, then presumably you will get an error when the
form is submitted, which will then require the user to edit the entry
again. Surely it is best to avoid that step by not allowing overlength
field input in the first place. Or am I missing something.