Posted: Wed Sep 03, 2008 3:40 pm Post subject: elements array
I am adding calendar right next to my date field in a form.
It only works for selecting one record at a time.
Before I added the calendar, it works for selecting multiple records.
what's wrong with my javascript correct ?
Thanks for any help.
.....my date field display in a table with in a form......
if ($result && mysql_num_rows($result)) {
while($query = mysql_fetch_array($result)) {
.
.
'|<input type="text" size="10" name="checkin_dates[]" value="'.$query['ro_checkin'].'" readonly="readonly"><a href="javascript:cal6.popup();"><img src="images/calendar/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a>'.
.
.
} }
......script after the </form>......
echo '<script language="JavaScript">'.
'var cal6 = new calendar3(document.forms[\'userform\'].elements[\'checkin_dates[]\']);'.
'cal6.year_scroll = false;'.
'cal6.time_comp = false;'.
'</script>';
I am not sure if elements[\'checkin_dates[]\'] is the correct syntax. It works for submitting one record, but not multiple records.
I was able to have the multiple calendar object work within a form (from last post). Now I want to reset/clear each individual calendar input within a form. The reset() resets all the dates in the form. How can I clear just one calendar input at a time. I had tried different code to clear one element, but didn't work. Thank you for any help.
echo "<form name='userform' method='POST' action='checkin.php'>";
$rows=0;
//table code starts here, but not showing...
if ($result && mysql_num_rows($result)) {
while($query = mysql_fetch_array($result)) {
.
.
$query['name'].'|'.
'|<input type="text" size="10" id='.$rows.' name="checkin_dates['.$rows.']" value="'.$query['ro_checkin'].'" readonly="readonly"><a href="javascript:cal'.$rows.'.popup();"><img src="images/calendar/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a><img src="images/calendar/reset.gif" onclick=javascript:reset()>'.
$query['ro_transmit']);
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum