Here is one way to do this using the onSelect option.  In my case I am
updating three selects which need non-leading zero dates and I am
using the default date format in the datepicker that uses leading
zeros in the month and day, so I strip those out.  Also I initialize
the datepicker from the three selects using the beforeShow option.

    $('#dpick').datepicker({
        beforeShow: readLinked, onSelect: updateLinked,
        buttonImage: '../Calendar_art2/calendar.png',
          showOn: 'button', buttonImageOnly: true,
        duration: ''
      });

    // Prepare to show a date picker linked to three select controls
    function readLinked() {
        $('#dpick').val($('#month').val() + '/' +
            $('#day').val() + '/' + $('#year').val());
        return {};
    }

    // Update three select controls to match a date picker selection
    // But need to get rid of leading zero on day and month first
    function updateLinked(t_date) {
          var s_mo = t_date.substring(0, 1);
          if (s_mo == '0') {
           $('#month').val(t_date.substring(1, 2));
        }
        else {
                 $('#month').val(t_date.substring(0, 2));
        }
        var s_day = t_date.substring(3,4);
        if (s_day == '0') {
                 $('#day').val(t_date.substring(4, 5));
        }
        else {
                 $('#day').val(t_date.substring(3, 5));
        }
        $('#year').val(t_date.substring(6, 10));
    }

Sean McKenna

On Jun 11, 12:01 pm, Peter Marino <[email protected]> wrote:
> Hi all,
>
> i've just tried the datepicker an it's very 
> nice.http://jqueryui.com/demos/datepicker/
>
> I can see if I add an ID to an input tag that the input tag gets
> update with the date selected in the datepicker.
>
> my question is I have 3 input tags one for day, month and year.
> is it possible when the user selects a date in the datepicker that
> it will automatically update the 3 input tags?
>
> anyone?
>
> Peter
>
> --
> Power Tumbling -http://www.powertumbling.dk
> OSG-Help -http://osghelp.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to