If I understand correctly, you would like the input prefilled with today's date before even opening the calendar, right? If so, you have to do that yourself. Datepicker only helps pick a date once opened!

... but you can use it's utility functions to help you do that. For example:

var input = $('#input_id');
input.datepicker(... set whatever option, define format ...);
// take the format from the input to make sure the date will be presented the same way as from calendar
var format = input.datepicker('option', 'dateFormat');
//      today's date with the right format in a string
var today = $.datepicker.formatDate(format, new Date());
//      finally fill the input
input.val(today);

Hope this helps!

On Jan 14, 2010, at 18:37 , Tractor Guy wrote:

I have a form that has a text input field with a datepicker attached.
I want to display today's date automatically without having to
actually go into the datepicker and select it. Sounds simple enough
but I am having difficulty.

Here is the javascript function...

<script type="text/javascript">
        $(function() {
                $('#jQueryUICalendar1').datepicker({ defaultDate:null });
        });
</script>


Here is the HTML portion....

<form name="form_signRequest" id="form_signRequest" class=""
method="GET" action="">
                        <input type="text" size="15"  class="dateInputField" 
value=""
id="jQueryUICalendar1" readonly="true"/>


Does anyone have a solution? Thanks in advance
--
You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en .



-- 
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to