Form not submitting some variables after adding jquery inline datepicker
Im submitting a form thats submitting firstname, lastname, email, date to my database, but since ive mad开发者_高级运维e some changes only the date is being submitted.
It was all working fine until i decided to make the jquery datepicker show inline on the page rather than having to click on a field to show the datepicker.
To make this datepicker inline i changed some code to this:
<script>
$(function() {
$('#datepicker').datepicker({altField: '#date'});
});
</script>
<form method="post" action="send.php">
<input type="text" name="firstname" id="firstname" class="yourinfo" ><br/>
<input type="text" name="lastname" id="lastname" value="Last Name" onFocus=this.value='' class="yourinfo"><br/>
<input type="text" name="email" id="email" value="Email Address" onFocus=this.value='' class="yourinfo"><br/>
<div id="datepicker"></div>
<input type="hidden" name="date" id="date"><br/>
<input type="submit" value="submit" >
</form>
Before i made the changes my code looked like this:
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
<form method="post" action="send.php">
<input type="text" name="firstname" id="firstname" class="yourinfo" ><br/>
<input type="text" name="lastname" id="lastname" value="Last Name" onFocus=this.value='' class="yourinfo"><br/>
<input type="text" name="email" id="email" value="Email Address" onFocus=this.value='' class="yourinfo"><br/>
<input type="text" name ="date" id="datepicker" value="Enter Your Prediction" onFocus=this.value='' class="yourinfo"><br/>
<input type="submit" value="submit" >
</form>
but this wasnt the way i wanted it to work as you had to click on the text field to display the datepicker.
is there anything that you can see that maybe preventing firstname lastname and email from being sent???
I think it might be that you do not have double quotation marks around the values of onFocus
. When I tripper them out, it works fine:
http://jsfiddle.net/william/eGGqS/1/
EDIT:
This one is closer to your example: http://jsfiddle.net/william/eGGqS/2/
精彩评论