Monday 15 February 2010

HTML5 Form validation with javascript basket validation combined? -



HTML5 Form validation with javascript basket validation combined? -

i'm working on sample request forum works basket, i've validated tweaking form uses html5 validation, works dandy. prior changing "a submit" button "input button", used stop form submission if basket had more 5 items in using this:

<a href="javascript:closefivecheck();"> button </a>

so validates form allow submit request more 5 items, don't want, , if alter anchor link, html5 fourm won't work, need way combine two.

here forum whole:

echo '<form name="search" id="search" method="post" action="ordersamples.php" enctype="multipart/form-data">'; echo '<div class="mainbasketcontact">'; echo '<a href="design-search.php"><img src="images/basketlong.png" /></a>'; echo '<p>enter details receive free samples. please allow 7 working days delivery.</p>'; echo '<div class="contactlabel">name</div><div class="contactlabel2"><input required="required" style="background:#'.$basketcolour.';" type="text" name="name" id="name" /></div><div style="clear: both;"></div>'; echo '<div class="contactlabel">company</div><div class="contactlabel2"><input style="background:#'.$basketcolour.';" type="text" name="company" id="company" /></div><div style="clear: both;"></div>'; echo '<div class="contactlabel">email</div><div class="contactlabel2"><input required="required" type="email" style="background:#'.$basketcolour.';" name="email" id="email" /></div><div style="clear: both;"></div>'; echo '<div class="contactlabel">tel</div><div class="contactlabel2"><input type="number" required style="background:#'.$basketcolour.';" name="tel" id="tel" /></div><div style="clear: both;"></div>'; echo '<div class="contactlabel">project title</div><div class="contactlabel2"><input style="background:#'.$basketcolour.';" type="text" name="project" id="project" /></div><div style="clear: both;"></div>'; //echo '<div class="contactlabel">address</div><div class="contactlabel2"><textarea style="background:#'.$basketcolour.';" name="address" id="address" /></textarea></div><div style="clear: both;"></div>'; echo '<p class="dcheader1">delivery address</p>'; echo '<div class="contactlabel">line 1</div><div class="contactlabel2"><input required="required" type="text" style="background:#'.$basketcolour.';" name="ad1" id="ad1" /></div><div style="clear: both;"></div>'; echo '<div class="contactlabel">line 2</div><div class="contactlabel2"><input type="text" style="background:#'.$basketcolour.';" name="ad2" id="ad2" /></div><div style="clear: both;"></div>'; echo '<div class="contactlabel">town/city</div><div class="contactlabel2"><input required="required" type="text" style="background:#'.$basketcolour.';" name="town" id="town" /></div><div style="clear: both;"></div>'; echo '<div class="contactlabel">postcode</div><div class="contactlabel2"><input required="required" type="text" style="background:#'.$basketcolour.';" name="postcode" id="postcode" /></div><div style="clear: both;"></div>'; echo '<div class="contactlabel">further<br/>notes</div><div class="contactlabel2"><textarea name="message" id="message" style="background:#'.$basketcolour.';"></textarea></div><div style="clear: both;"></div>'; echo '<input type="submit" name="submit" value="submit" />'; echo '</div>'; echo '<div style="clear: both;"></div>'; echo '</div>'; echo '</form>';

i've had fair around , had no luck far, if has suggestions please throw them way! thankyou! :)

just utilize onclick attribute on form button, should create behave same way link had :

<input type="submit" name="submit" value="submit" onclick="return closefivecheck();" />

javascript html5 validation forum

No comments:

Post a Comment