The reason is both inputs have idential id's (i.e. #datepicker) so jQuery is
simply ignoring the second input.
Try:
<input type="text" name="strDateFrom" size="10" value="" id="strDateFrom"
class="textbox datepicker">
<input type="text" name="strDateTo" size="10" value="" id="strDateTo"
class="textbox datepicker">
And:
$('.datepicker').datepicker();
On Fri, Jun 5, 2009 at 3:57 AM, Charles <[email protected]> wrote:
>
> Hi there,
>
> I am actually having a quite odd problem with the jQuery Datepicker...
> I've been using this datepicker for almost a year in more than 15 Java/
> J2EE application, but right now I have the following problem : jQuery
> doesn't want to load multiple instances in the same HTML form.
>
> For example, I have two dates (so two input text field with different
> names): Start date and End date.
> <input type="text" name="strDateFrom" size="10" value=""
> id="datepicker" class="textbox">
> <input type="text" name="strDateTo" size="10" value="" id="datepicker"
> class="textbox">
>
> The jQuery script is the following :
>
> *******************************************************************************************
> locale = "en_US";
>
> $(document).ready(function() {
>
> // French
> if(locale == 'fr_CA') {
> $.datepicker.setDefaults($.datepicker.regional['fr']);
> // English
> } else {
> $.datepicker.setDefaults($.datepicker.regional['']);
> }
>
> $('#datepicker').datepicker();
> });
>
> *******************************************************************************************
>
> The JSP page loads without any error, so I launched the IE Developer
> Toolbar in order to see if jQuery built the datepickers, as usual.
> Here is what I see :
> <INPUT class="textbox hasDatepicker" id="datepicker" size="10"
> name="strDateFrom" _calId="0" jQuery1244144261442="4" value="" />
> <INPUT class="textbox" id="datepicker" size="10" name="strDateTo"
> value="" />
>
> The second datepicker doesn't have the jQuery1244144261442 and _calId
> attribute, which is probably the cause of my problem. But WHY? This is
> really strange since I used this datepicker version for more than a
> year!
>
> Anyone has an idea?
>
> Thank you very much
>
> Charles Morin
> CRA
>
> >
>
--
Ca-Phun Ung
+ http://yelotofu.com
+ hongkong, zce, jquery, jqueryui, php, css, html
--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---