Forum: Ruby on Rails newbie q: Truncate text field

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Vince W. (Guest)
on 2005-12-14 05:47
I'm trying to incorporate a field where a user can enter a quantity
(online store app).  I've tried adding this to my

 <td width="40" align="center"><%= text_field 'line_items', 'quantity'

(I'm a total newbie so if there is a better way to pass the qty for an
online order please do suggest!)

That does indeed put a quantity field where I want it but it's pretty
big.  Changing the length of the dbase field doesn't reduce it.  Ideally
I'd like it big enough to enter 3 digits and that's it.  How can I do

Thanks in advance..
Bruce B. (Guest)
on 2005-12-14 08:28
(Received via mailing list)
> <%= text_field 'line_items', 'quantity'  :size=>3%>
Vince W. (Guest)
on 2005-12-14 17:33
bruce balmer wrote:
>> <%= text_field 'line_items', 'quantity'  :size=>3%>

Ok, I got it, full line of code ended up being:

<td width="40" align="center"><%= text_field 'line_items', 'quantity',{:
size=>3} %> </td>

Thanks Bruce!
Bruce B. (Guest)
on 2005-12-14 21:52
(Received via mailing list)

You're welcome.  Odd thing is that you don't need those curly braces
around :size=>whatever.  Maybe it is correct form and maybe it is
important and MAYBE I am lucky that my sites are working.

Anyone care to comment?

This topic is locked and can not be replied to.