I have date field (id begin-date)
$( "#begin-date" ).datepicker({
minDate: -20,
maxDate: "+1M +10D",
dateFormat: "yy-mm-dd",
altFormat: "yymmdd"
});
On post, it prints the format as yy-mm-dd (2010-12-08), when it should print as yymmdd (20101208)
Any ideas of why it is not posting it properly with altFormat set?
input field rendered:
<input type="text" name="begin_date" id="begin-date" class="validate[required]" value="" />
The altFormat
option doesn't control the formatting of the input with the date picker, but the format of an alternate (usually hidden) field specified by the altField
option, like this:
$("#begin-date").datepicker({
minDate: -20,
maxDate: "+1M +10D",
dateFormat: "yy-mm-dd",
altFormat: "yymmdd",
altField: "#alt-date"
});
You can test it out here; what you probably want is to just put the name
on that alt field and that's what'll get posted...without a name
the field with the date picker won't get serialized/submitted, for example:
<input type="text" id="begin-date" class="validate[required]" />
<input type="text" id="alt-date" name="begin_date" />
the altFormat must work with altField;
<input type="text" name="pushTime" class="datetime" id="pushTime"/>
$(".datetime").datepicker({altFormat:"yy-mm-dd",altField: "#pushTime"});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With