HTML - Form Validation Issues
If you look here at http://www.babyjai.com/quote.php you will see the form validates before it tries to push it thru, how come when you look at http://dinasky.me/contact.php it doesnt do it, it just pushed it thru, i cannot figure it out!
Similar TutorialsHi... Trying to get this site running but had to use somebody else's code for the forms and I cannot seem to get them working... Here's the link... http://artinludlow.com/joe/index.html Do not go to the main "com/index.html" page, use the "joe/index.html" directory. thanks I have a photography website that is set up for purchasing prints. I had one of you wonderful people help me out with a form problem some time ago. I needed information to be inserted into the form based on the particular page (or photo) that the person was on. It needed to insert the photo name in the form that came up when you clicked the purchase link. All was working great until a few weeks ago. Now, when you click the link, it inserts the name, but the form thinks the field is blank. Since its a required field, the user still has to type it. Is there a easy fix for this? Here is the site: http://www.sthompsonphoto.com/galler...p?showimage=59 I cant figure it out! Any help would be great! Thanks! I'm thinking this is the right section, but since I have several questions, I'll just go along as they're answered, or moved so not to irritate all of you. I'm designing a product form for a website at the moment, the basics of it are all there and completed, I've just run into a few snags with things that should've been very simple. First off I'm trying to design a preview area which takes its information from a bunch of dropdowns. Theres just one tiny problem, I know its tiny, but I can't seem to find it. If anyone could shed some light on this I'd greatly appreciate it. Now I'm going to warn you, theres alot of alert boxes that'll pop up if you test this in a browser, thats for my own purposes until its all done. So you may wanna turn your sound off if you look at it. Hi everyone, does anyone know how to make it so, on a form, when a person inputs their phone number it wont accept anything less than 11 numbers and anything more than 11 numbers? Thanks When trying to validate more then one text box, the code ignores the first set of code and moves straight to the second :\ why does it do that? HTML Code: <script type="text/javascript"> <!-- function validate_form ( ) { valid = true; if ( document.MyFrom.fname.value == "" ) { alert ( "Please fill in the 'Your Name' box." ); valid = false; } return valid; } function validate_form ( ) { valid = true; if ( document.MyFrom.lname.value == "" ) { alert ( "Please fill in the 'Youlr Name' box." ); valid = false; } return valid; } </script> Hi I am using a CGI-BIN script to submit an html form to an email address. I am wondering how i can make field in this html form "required"?? Would be thankful if someone could point me in the right direction. Could someone please advise how to make a singular field validated before sending via smtp, through a Content Management system. I do not have access to the CSS side of things and am hoping this will help my own knowledge banks. The RTE does accept some types of Javascrpt but a resolution in this would ahve to be very simple. Appreciated any help given, thanks all. Tom Hi guys i have a form that has name , email , country (drop down list ) , state , city , address , phone . I would like to validate the form so that when a space is left empty for example the "name" space is left empty a message box alerts them <DIV id=regform style="BOTTOM: 60px; RIGHT: 411px; POSITION: absolute"> <FORM action=sendmail.php method=post>sitename.com<b style="COLOR: black;font-family:arial;font-size:20%;"></b> <BR><INPUT size = 15 name=email> <INPUT type=submit value=Submit></FORM></DIV> This code makes my email box move dependent on the size of your web browser window. How can I stop this ? Really appreciate help here. Thankyou. G'day guys, I'm having trouble getting my submit button aligned to the right edge of the textarea above it. Could you please tell me what I'm doing wrong, (still a bit raw when it comes to CSS). Here's the link: http://csusap.csu.edu.au/~jpress03/impel/contactus.html Here's my CSS code: Code: #frmwrap { border: 1px dashed #8DBA2C; padding: 10px; width: 350px; } form { font-family: Arial, Sans-serif; } input, textarea { border: 1px solid #gray; font-family: Arial, Sans-serif; } label { display: block; float: left; width: 100px; } form div { margin-top: 3px; } .button { background: #f1f1f1; border: 1px solid gray; } Any help is greatly appreciated. Cheers, Jamie I have never had this error before until now, where I am trying to submit a jQuery validated form, yet my submit button won't work, I currently am not using the input type submit button, even when I do use it though I get the same error as using a <a> link that calls a javascript function to submit the form, I have a duplicate of this code and it works fine on another page, but just not here. Here is my mess: http://motb.isgreat.org/ It probably is easier to just check the whole source, since my code is scattered. This website is targeted for WEBKIT BROWSERS ONLY! To navigate to the issue on the page itself, press the gold login button on the RIGHT, and try submitting the form, I know the join form doesn't work, since I am not done with the page yet. But the login form should target to http://motb.isgreat.org/login.php which has a duplicate of my form but it works, im really confused, it may be with my JavaScript. Any Help is appreciated. I know my code is messy, my excuse is only being 15, but yeah… at least most of it functions Hi I realy need help with my coursework! I am really bad with HTML and forms I want my form to not send to the email address i have specified unless all the fields in the form are full, this wont be a problem with the select boxes and the radio buttons as they are already selected. I only need to validate the text field and area. This is my form so far ... Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; } .style1 {color: #FFFFFF} .style2 {font-size: 14px} --> </style> <form action="script.cgi" onSubmit="return checkform()"> <script> function checkform() { if (value of textfield is null) { alert('Please insert your name'); return false; } else if(value of textarea is null) { alert('Please enter your comments for this website'); return false; } return true; } </head> <body> <form action="emailformhandler.php" method="post" name="Feedback Form" class="style2" id="Feedback Form"> <p align="left">Your Name <span class="style1"> .................................................</span> <input type="text" name="textfield" size="30" maxlength="100" /> </p> <p>Where do you live? <span class="style1">....................................</span> <select name="select" size="1"> <option>Dunstable</option> <option>Luton</option> <option>Houghton Regis</option> <option>Other</option> </select> </p> <p>How did you find out about this website? <span class="style1">....</span> <select name="select2" size="1"> <option>Your Teacher</option> <option>Mr Holmes</option> <option>Word Of Mouth</option> <option>SSCO</option> <option>Search Engine</option> <option>Other</option> </select> </p> <p><img src="http://himeshs.co.uk/ICT/untitled.GIF" width="181" height="56" /><span class="style1">.......................</span> <textarea name="textarea" cols="30" rows="5"></textarea> </p> <p> What is your rating of this website <span class="style1">.............</span> <input name="radiobutton" type="radio" value="radiobutton" checked /> Excellent <input name="radiobutton" type="radio" value="radiobutton" /> Good <input name="radiobutton" type="radio" value="radiobutton" /> Average <input name="radiobutton" type="radio" value="radiobutton" /> Poor</p> <p> <input type="submit" name="Submit" value="Submit Form" /> <input type="reset" name="Submit2" value="Clear Form" /> </p> </form> </body> </html> I would appreciate any help i could get and dont forget im a noob at forms nd stuff like that lol Thanks! Himesh <form class="contact" method="post" action="mail.php#contact" /> I have a form that i want to ensure is filled out correctly before the user is able to proceed. http://chimp.cc/start.htm If the user fails to fill out the terms and conditions box with a "Yes"when the user clicks submit, i want a message to pop up to tell them to complete it. and to return the user to that field for completion. I honestly have no idea how to do this, can someone please help me. I have attached the source code too. Cheers Andy have a form.. has certain input fileds like - sptn, rptn, mps, mpr etc am trying to validate all entries to be entirely numeric and within range if (sptn>0 && sptn<65535 && rp>0 && rp<65535 && rptn>0 && rptn<65535 && mps>0 && mps<65535 && mpr>0 && mpr<65535) alert("all values ok"); problem is => this works even if i enter any of the values as =-=-=- or ./,/.,-= or any other junk characters but this snippet works fine if (spn>99 && spn<=999 && rpn>99 && rpn<=999) alert("ok"); please advise I'm using Godaddy's gdform.php form mailer for my forms. The forms work perfectly except the validation. I need the visitors to fill in the fields and then submit the information to my email, but the problem is that everyone can submitt even if he doesn't fill in the form. I want all of the fileds to be required. Is there something wrong with the code ? Here it is : <form action="/gdform.php" method="post"> <table align="center"> <input type="hidden" name="subject" value="Form Submission"> <input type="hidden" name="redirect" value="/Add/thankmes.html"> <input type="hidden" name="required" value="YourName, Email, description"> <tr> <td><p><font color=WHITE font size=4>Your Name:</p> </font></td> <td align=center height=50><p><input type="text" name="YourName" size="52"/></p></td> </tr> <tr> <td><p><font color=WHITE font size=4>Your E-mail:</p> </font></td> <td height=50><p><input type="text" name="Email" size="52"/></p></td> </tr> <tr> <td><p><font color=WHITE font size=4>Your Message:</p> </font></td> <td><br><p><textarea name="description" cols="40" rows="5"> </textarea></p></td> </tr> <tr> <td><input type="submit" name="submit" value="Send"/></td> </tr> </table> </form> Hi Ya, I am trying to validate the telephone number for a form. I would really like some help. You see when i leave the telephone field blank the code error message comes up telling me that i cant leave that field blank. When i then put in illegal characters it says that i used illegal characters but instead of clearing the feild,allowing me to type the correct phone number and then moving onto the getradio if statement it goes to receipt page when the submit button is clicked instead of doing the validate checks first and then moving onto the receipt.html page. This is the problem area. Code: if (form.phone.value == "") { alert("Please enter your telephone number for shipping Information."); form.phone.focus(); return (false); } else { validate(); } if (getRadio("pay") == null) { alert("Please choose a payment method."); return (false); } return (true); } //--></script> <script language="javascript"> function validate() { if (isNaN(parseInt(this.value))) { alert("The phone number contains illegal characters."); form.phone.focus(); return (false); } } //--></script> The below code is for the form. Code: <FORM name="information" action="..\..\Cars\GT\receipt.html" method="get" onSubmit=" return form_Validator(this)"> <!-- Tells the button what action to take --> The below code is the full validation check function Code: <!-- This is used to validate the radio buttons to make sure that one of those options are pressed --> <script language="javascript"> function getRadio(radioName){ var inputs = document.getElementsByTagName('input'); var ret = null; for(var i = 0; i < inputs.length; i++){ if(inputs[i].type == 'radio' && (inputs[i].name == radioName || inputs[i].id == radioName) && inputs[i].checked){ ret = inputs[i].value; } } return ret; } <!-- This is used to validate the text boxes to make sure that an item is written into it --> <!-- I f the next box remains empty an error message appears --> function form_Validator(form) { if (form.first_name.value == "") { alert("Please enter your first name for shipping Information."); form.first_name.focus(); return (false); } if (form.last_name.value == "") { alert("Please enter your last name for shipping Information."); form.last_name.focus(); return (false); } if (form.address.value == "") { alert("Please enter your address for shipping Information."); form.address.focus(); return (false); } if (form.acode.value == "") { alert("Please enter the area code for shipping Information."); form.acode.focus(); return (false); } if (form.phone.value == "") { alert("Please enter your telephone number for shipping Information."); form.phone.focus(); return (false); } else { validate(); } if (getRadio("pay") == null) { alert("Please choose a payment method."); return (false); } return (true); } //--></script> <script language="javascript"> function validate() { if (isNaN(parseInt(this.value))) { alert("The phone number contains illegal characters."); form.phone.focus(); return (false); } } //--></script> </head> Hi, I'm new to the forums, so if this is in the wrong place i apologize. I've been thrown into the fire at work to develop some of the website and I'm absolutely stuck on one of my forms. It's submitting name, email and a couple checkboxes. I need the script to verify that the fields are not blank, the email field is a valid address, and the checkboxes are checked. Any ideas? <body> <script> function Do_it() { if(document.Form1.FirstName.value == "") { errormessage += "\n\nPlease fill out your first name."; } if(document.Form1.LastName.value == "") { errormessage += "\n\nPlease fill out your last name."; } if(document.Form1.email.value == "") { errormessage += "\n\nPlease fill out your email address."; } if(document.Form1.checkbox1.value == "") { errormessage += "\n\nPlease verify you are 13 or older."; } if(document.Form1.checkbox2.value == "") { errormessage += "\n\nPlease verify you have read and agree to the Privacy Policy."; } } return false; else return true; } </script> <div id="Layer1"> <div align="center"><img src="bg.jpg" width="800" height="600" /> </div> <div id="Layer13"> <form action="feedback.php" method="post" name="Form1" onSubmit="return Do_it()"> <table width="100%" height="100%" border="0" cellpadding="5" cellspacing="2" style="width: 445px; height: 100%;"> <tr> <td nowrap="nowrap"><div align="right"> First Name:</div></td> <td><input class="dsR2" type="text" name="FirstName" size="43" /></td> </tr> <tr> <td nowrap="nowrap"><div align="right"> Last Name:</div></td> <td><input class="dsR3" type="text" name="LastName" size="43" /></td> </tr> <tr> <td nowrap="nowrap"><div align="right"> E-mail:</div></td> <td><input class="dsR4" type="text" name="email" size="43" /></td> </tr> <tr> <td nowrap="nowrap"><div align="right"> <input class="dsR1" type="checkbox" name="checkbox1" /> </div></td> <td> I am over 13 years of age. </td> </tr> <tr> <td nowrap="nowrap"><div align="right"> <input class="dsR1" type="checkbox" name="checkbox2" /> </div></td> <td>I read and agree to the <a href="terms.html" target="_blank">Privacy Policy </a></td> </tr> <tr> <td colspan="2" nowrap="nowrap"><div align="center"> <p> <input name="submit" type="submit" class="dsR1" value="Submit" /> </p> </div></td> </tr> <tr> <td colspan="2" valign="top"><div align="center"><span class="style1"> </span> <div id="Layer3"> <div align="center"><span class="style2">We respect your privacy and understand the value of protecting personally identifiable information, we pledge not to sell any personally identifiable information to any third party</span>.</div> </div> </div></td> </tr> </table> </form> </div> </body> |