the below spry validation form created dw cs6
i created html form , posted php mysql database. 1 of form lines enter date. line using "out of box" sprytextfield data validation without modification of css or js:
html
<span id="sprytextfield1">
<label for="servcomdate">starting date?</label>
<input type="text" name="servcomdate" id="servcomdate">
<span class="textfieldrequiredmsg">a value required.</span>
<span class="textfieldinvalidformatmsg">invalid format.</span>
</span>
<script type="text/javascript">
var sprytextfield1 = new spry.widget.validationtextfield("sprytextfield1", "date", {hint:"00/00/0000", format:"mm/dd/yyyy"});
</script>
on submission, form value captured via php , date format converted mysql format before entering database.
php
$servcomdate = date("y-m-d", strtotime($_post['servcomdate']));
all of above working perfectly.
now, have created different page html form edit information. first, php pulls field database , converts mysql format format used in above sprytextfield created in.
php
$servcomdate = strftime("%m/%d/%y", strtotime($row["servcomdate"]));
then html form populated existing value
html
<span id="sprytextfield1">
<label for="servcomdate">if service coming soon, know when service start being offered?</label>
<input type="text" name="servcomdate" id="servcomdate" value="<?php echo $servcomdate; ?>">
<span class="textfieldrequiredmsg">a value required.</span>
<span class="textfieldinvalidformatmsg">invalid format.</span>
</span>
when pre-populating form existing value displays proper format in input box, shows these "errors":
value required. invalid format.
as said above, have not changed of css or js loaded spry textfield, did not include here.
i doing wrong pre-populating spry textfield default value.
what correct have default value on spry validation date textfield?
thanks in advance!
make sure in edit page constructor looks like
var sprytextfield1 = new spry.widget.validationtextfield("sprytextfield1", "date", {hint:"00/00/0000", format:"mm/dd/yyyy"});
the following works fine me
<span id="sprytextfield1">
<label for="text1"></label>
<input type="text" name="text1" id="text1" value="<?php echo strftime("%m/%d/%y", strtotime($row_recordset1['userregistrationdate'])); ?>">
<span class="textfieldrequiredmsg">a value required.</span><span class="textfieldinvalidformatmsg">invalid format.</span></span>
<script type="text/javascript">
var sprytextfield1 = new spry.widget.validationtextfield("sprytextfield1", "date", {hint:"00/00/0000", validateon:["blur"], format:"mm/dd/yyyy"});
</script>
gramps
More discussions in Dreamweaver support forum
adobe
Comments
Post a Comment