views:

37

answers:

0

Using Keith Wood's jQuery Datepicker, version 4.0.3.

I'm a JavaScript novice looking for simple example of using an inline datepicker for these complementary purposes:

1) Put an inline datepicker date range INTO a form variable(s).
2) Get an inline datepicker date range FROM a form variable(s).

Classic add/modify situation. The code to do this certainly must be dead obvious!

My attempt follows below.
It works for situation #1, but please show me a better way?
It doesn't work right for situation #2. I want to use variables.

<script type="text/javascript">
$(function() {
    $('#inline_picker').datepick({
    rangeSelect: true,
    altField: '#id_server_dates', //<--Works, but isn't there a better way?
    });
    $('#inline_picker').datepick('setDate', '10/21/2010', '10/29/2010'); //<--UGH! NO!
});
</script>
<form action="modify" method="POST">
<div id="inline_picker"></div>
<input type="hidden" id="id_server_dates" name="server_dates" />

Thanks so much!