Thursday, September 29, 2011

[Rails] Rails 3.0 + jQuery Datepicker. Edit value

I recently started using jQuery and the Datepicker with an application
of mine.

with the help of http://railscasts.com/episodes/213-calendars I got the
datepicker working on a text_field containing a date.

Problem however is when we edit a model. Since a text_field shows the
database value for a field by default, it displays the date as
'2011-05-24'. When we open te datepicker on this field it defaults to
'today' since it cant read the current value of the field.

Picking a date will display it in the format specified of datepicker,
but saving is no problem. I guess Rails is smart enough to figure it out
between the I18n.

My question is, how can I make sure my date is displayed in the format I
want it to be in the text_field of a form when editting.

--
Posted via http://www.ruby-forum.com/.

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate