Reputation: 9919
I am trying to the following:
value
of a text input
This is my code:
$("a#inline").fancybox();
$('#calendar').fullCalendar(
{
dayClick: function (date)
{
$('a#inline').click();
$('.datepicker').val(date);
}
});
HTML
<a href="#data_entry" id="inline">Add Event</a>
<div style="display:none">
<div id="data_entry">
<form action="events/events_save" method="post" name="events_form" id="events_form">
<input type="text" name="date" value="<?php date('m/d/Y'); ?>" class="datepicker">
</form>
</div>
</div>
I am running into the following issues:
when clicking on a date on the calendar the fancybox pops up and I get Mon Apr 25 2011 00:00:00 GMT-0400 (EDT)
==> I need this to be mm/dd/yy like 04/25/11
if right after that I close the fancybox and click on the anchor tag "Add Event"
, the fancybox opens but the date is populated with Mon Apr 25 2011 00:00:00 GMT-0400 (EDT)
==> it should actually contain today's date because of the PHP string I put in the value
field (this is fixed only if I refresh)
Anyone have suggestions on how to solve either issue?
Thanks a ton.
Upvotes: 0
Views: 9392
Reputation: 61
Perfect! This helped me out too as I could not find any documentation on how to use formatDate method...
alert($.fullCalendar.formatDate( calEvent.start, "yyyy-MM-dd"));
Upvotes: 1
Reputation: 14766
To format dates, run the date through fullcalendar's formatDate method. Try:
$('.datepicker').val($.fullCalendar.formatDate( date, "MM/dd/yy"));
Upvotes: 9