»
EnglishFrenchVietnamese

Print - Data Checker - JavaScriptBank.com

Full version: jsB@nk » Email » Data Checker
URL: https://www.javascriptbank.com/data-checker.html

Data Checker © JavaScriptBank.comThis JavaScript create a contacter which will alert if you do not enter all required fields.

Full version: jsB@nk » Email » Data Checker
URL: https://www.javascriptbank.com/data-checker.html



JavaScript
<SCRIPT>function Process(){Result=""Warn=new Array("* Your name.\n","* Your email is not correct.\n","* Please pick some fruits.\n","* Your age group, please!\n","* Please write something in the comment box.\n")F=document.forms[0]if(F.Name.value.length<1) Result+=Warn[0]Em=F.Email.valuere=/.+\@.+\..+/OK = re.exec(Em)if(!OK)Result+=Warn[1]Fr=0for(x=0;x<F.Fruit.length;x++){if(F.Fruit[x].checked==true)Fr=1}if(Fr==0)Result+=Warn[2]AgeG=0for(x=0;x<F.Age.length;x++){if(F.Age[x].checked==true)AgeG=1}if(AgeG==0)Result+=Warn[3]if(F.Comments.value.length<5)Result+=Warn[4]if(Result.length>2){alert("You have not filled in the form properly!\n\nPlease check again these inputs:\n\n"+Result+"\n__________________\n\nThanks!")return}else{F.submit()}}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
Please fill in this form and click <B>SEND</B><br> <FORM><TABLE cellPadding=10 border=1>  <TBODY>  <TR>    <TD>Name:<INPUT name=Name size="20">     <TD>Email:<INPUT name=Email size="20">   <TR>    <TD align=middle colSpan=2>Fruits:<BR><INPUT type=checkbox value=Orange       name=Fruit>Orange <INPUT type=checkbox value=Banana name=Fruit>Banana       <INPUT type=checkbox value=Apple name=Fruit>Apple <INPUT type=checkbox       value=Pear name=Fruit>Pear   <TR>    <TD align=middle colSpan=2>Age group:<BR><INPUT type=radio value=0-10       name=Age>0-10 <INPUT type=radio value=10-20 name=Age>10-20 <INPUT       type=radio value=20-30 name=Age>20-30 <INPUT type=radio value=30-40       name=Age>30-40   <TR>    <TD align=middle colSpan=2>Comment:<BR><TEXTAREA name=Comments rows=4 cols=30></TEXTAREA>   <TR>    <TD align=middle colSpan=2><INPUT onclick=Process() type=button value=SEND> </TR></TBODY></TABLE></FORM><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->