Many Thanks!
Got it working in about 5 minutes. For anyone else who runs across
this posting the code below will help.
To populate the purchase date from the database on the "Edit Item" form:
$(function() {
$("#datepicker").datepicker();
var myDate="<%= @item.purchase_date.strftime("%m/%d/%y") %>";
$("#datepicker").val(myDate);
});
To populate the current date on the "New Item" form:
$(function() {
$("#datepicker").datepicker();
var myDate="<%= Date.today.strftime("%m/%d/%y") %>";
$("#datepicker").val(myDate);
});
On Tue, Nov 10, 2009 at 9:04 AM, Fontzter <[email protected]> wrote:
> var dateFromDbFormattedAccordingly;
>
> $("#IdOfTheInputBoxThatHasTheDatepicker").val
> (dateFromDbFormattedAccordingly);
>
> That should be all there is to it.
>
> Hth,
>
> Dave
>
> On Nov 8, 8:57 pm, Sunny Beach <[email protected]> wrote:
>> I am using the datepicker in a Rails application and it works fine to
>> create a record. Is there a way to have the datepicker text box
>> populate with the saved value pulled from the database?
>>
>> I can easily retrieve and format the date correctly... just can't get
>> it in the box.
>>
>> Thanks,
>> Sunny
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "jQuery UI" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/jquery-ui?hl=.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=.