:readonly => true was the perfect solution for this problem! Thanks!

For future readers' reference, the text_field now looks like this:

<%= text_field "invoice", "due_date", :readonly => true, :class =>
'textbox' %>

This allows the visitor to see the field's content, but not edit it.

On Mar 20, 9:02 pm, Hassan Schroeder <hassan.schroe...@gmail.com>
wrote:
> On Sat, Mar 20, 2010 at 11:52 AM, Joshua Martin <josmar52...@gmail.com> wrote:
> > The text_field should be disabled so that the user can't put it a
> > random date without regard to the terms or invoice date.
>
> > However, adding the :disabled attribute to the text_field, or adding
> > the disabled attribute via JQuery results in the value not being saved
> > when the invoice is created.
>
> > How can I make the value of the disabled text_field be recorded during
> > the @invoice.save?
>
> You can't because, by definition, a disabled control cannot be
> successful:
>
> <http://www.w3.org/TR/html401/interact/forms.html#adef-disabled>
>
> What you probably want to use is "readonly", defined immediately
> following the above entry...
>
> --
> Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
> twitter: @hassan

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to