»
AnglaisFrançaisVietnamien

Imprimer - Champs obligatoires - JavaScriptBank.com

Version complète: jsB@nk » Form » Validation » Champs obligatoires
URL: https://www.javascriptbank.com/required-fields.html

Champs obligatoires © JavaScriptBank.comContrôles forme domaines afin de vérifier que chaque champ est laissé vide. Affiche un message d'avertissement message si tout les champs vides sont présents. Super!

Version complète: jsB@nk » Form » Validation » Champs obligatoires
URL: https://www.javascriptbank.com/required-fields.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Wayne Nolting (w.nolting@home.com)<!-- Beginfunction verify() {var themessage = "You are required to complete the following fields: ";if (document.form.first.value=="") {themessage = themessage + " - First Name";}if (document.form.last.value=="") {themessage = themessage + " -  Last Name";}if (document.form.email.value=="") {themessage = themessage + " -  E-mail";}//alert if fields are empty and cancel form submitif (themessage == "You are required to complete the following fields: ") {document.form.submit();}else {alert(themessage);return false;   }}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form  name=form method="post" action="" style="text-align: left; width: 50%;"><input type=text name="first" size="20"> First Name<BR><input type=text name="last" size="20"> Last Name<BR><input type=text name="email" size="20"> E-Mail<BR><BR><input type=button value="Submit Request" onclick="verify();">  <input type=reset value="Clear Form"><br></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->