php - why is jquery not passing a post value -
i have page 2 forms on it. shouldn't problem, not working. jquery looks this:
$(document).ready(function() { $("table.jobs tbody tr td#ejob").click(function() { var $this = $(this); var col = $this.text(); var leftcelltext = $this.prev().text(); $('#jobid').val(leftcelltext); if (col == '') alert("please pick column"); else $('#jobupdate').submit(); }); var = new date(); var month = now.getmonth()+1; var day = now.getdate(); var year = now.getfullyear(); if (month<10){month='0'+month} if (day<10){day='0'+day} var = month +"/"+ day + "/" + year; var calendarbox = $('#caldate'); //$('#caldate').val(calendarbox.datetimepicker('getdate')); var thisone = $('#caldate').val(calendarbox.datetimepicker('getdate')); calendarbox.datepicker( { mindate:('setdate', '' , new date()), defalt:calendarbox.val(now), onselect: function (selecteddatetime) { $('#caldate').val(calendarbox.datetimepicker('getdate')); alert("sendeing " + $('#caldate').val(calendarbox.datetimepicker('getdate'))); $('#calendarform').submit(); } }); } );
and forms this:
echo "<form id='calendarform' action='view_rev8.php' method='post'>"; echo "<table border='0' width='100%'class='calendartable'>"; echo "<tr><td align='left'>click on job number update or change job information</td>"; echo "<td align='right'></td>"; echo '<td align="right">calendar: <input type="text" id="caldate" size="15" name"caldate"/></td></tr>'; echo "</table>"; echo "</form>"; //creates form post jobid updatejobform.php echo'<form id="jobupdate" action="../forms/updatejobform.php" method="post">'; echo'<input type="hidden" name="jobid" id="jobid">'; echo '</form>';
the first function handles when user clicks on table item , submits post value without problem. datepicker works , form gets submitted, following error: undefined index: caldate following page:
$pickeddate = $_post['caldate']; include_once("../php/job_class.php"); echo $pickeddate; $obj=new jobs(); echo "<div style='border:solid 1px '>"; foreach ($obj $val) { echo "<pre>"; echo print_r($obj); //echo $obj->jobinfo(); echo "</pre>"; echo "</div>"; }
why not working? simple post defined form, , far can see fields named consistently , accurately.
you have invalid html in input tag. (it's missing =
sign.)
<input type="text" id="caldate" size="15" name"caldate"/>
should be:
<input type="text" id="caldate" size="15" name="caldate"/>
so js setting value since you're using id, name used posting form, why empty.
Comments
Post a Comment