Jump to content

dooballoh

Members
  • Posts

    7
  • Joined

  • Last visited

dooballoh's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Aaah~~Thank you very much to all of you.
  2. Thank you very much Bassam.But no, it doesn't works.Any other ways?Thank you in advance.
  3. Thank you very much Ankit Shah.Hahaha it's works great. I have an another question.How can I do either highlight, or put border(red) outside of the first radio button(if not possible whole radio group)?So that users can easily see what they are missing.Example HTML;Male: <input type="radio" name="gender" value="Male" />Female: <input type="radio" name="gender" value="Female" />Either 1. highlight, or red border on "Male" radio button2. red border around whole "Male" and "Female" radio group.Thank you very much in advance.
  4. How can I put focus on a radio button on "return false" ?Example validation codes; var radioSelected = false; for (var i=0; i<document.formname.gender.length; i++) { if (document.formname.gender[i].checked) radioSelected = true; } if (!radioSelected) { alert('message goes here'); I'd like to put focus here.focus(); return false; } Thank you in advanse.
  5. Thnk you very much again jesh.I've tested the codes you've posted for #2) and #3) and it gives me an error saying that; and it occurs at here;function validate(element){ if(element.value == "") However, I've tried this for myself(searched google for another 2 days ) javascript; function checkForm() {name = document.getElementById("name").value;email = document.getElementById("email").value;comment = document.getElementById("comment").value;if (name == "") {hideAllErrors();document.getElementById("nameError").style.display = "inline";document.getElementById("name").select();document.getElementById("name").focus();document.getElementById("name").style.background ="lightyellow";return false;} else {document.getElementById("name").style.background ="";}REPEATMORE FIELDSreturn true;}function hideAllErrors() {document.getElementById("nameError").style.display = "none"document.getElementById("emailError").style.display = "none"document.getElementById("commentError").style.display = "none"} And HTML; <form onSubmit="return checkForm();" method=post action="myscript.php"><span class=label>Name:</span><input type=text value="" id=name><div class=error id=nameError>Required: Please enter your name<br></div><br></form> It works for changing background color, but these problems have to be fixed.1. It's highlight ONLY one field in yellow (at the first field missed). How can I do to highlight ALL required fields that users left blank?2. Let say if user left 3 fields blank, required note and yellow field shows(focusing) at first field.When I click on second or third required field left blank, this required note still stays on first field.How can I do this error note(required note) moves to any of clicked fields?3. I'd like to add 'close fuction' inside of this error note.How can I do this?Thank you very much again.
  6. Thank you very much jesh.It works just like the second set of code I've posted above.Except, it shows ALL error notes at once and hide as I type some in inputbox instead one at a time.What I've been looking for is that1. When user left required field(s) left blank, then highlight(for example: change color to lightyellow) the required field(s).Note: When required field is filled in change color back to "white"2. Instead of alret popup, error message will show right next to required field, one at a time start from the first required field and as it fills in.This error message box shold have "close" function. I assume that using CSS.3. Although it's highlighted ALL required fields, and show the error message at the first required field,user might be left first field and click the second(or any other required field) field, then show the error message for that field.Error message could be able to up and down as user click whichever required field.Basically, I'd like to add just like how Ajax "ValidatorCallout" works.At this point, this is the code and HTML and I'd like ADD fuctions above to it.Javascript; function checkForm() {name = document.getElementById("name").value;email = document.getElementById("email").value;if (name == "") {hideAllErrors();document.getElementById("nameError").style.display = "inline";document.getElementById("name").select();document.getElementById("name").focus();return false;} else if (email == "") {hideAllErrors();document.getElementById("emailError").style.display = "inline";document.getElementById("email").select();document.getElementById("email").focus();return false;} return true;} function hideAllErrors() {document.getElementById("nameError").style.display = "none"document.getElementById("emailError").style.display = "none"} HTML; <form onSubmit="return checkForm();" method=post action="myscript.php"><span class=label>Name:</span><input type=text value="" id=name ><div class=error id=nameError>Required: Please enter your name<br></div><br><span class=label>Email:</span><input type=text value="" id=email ><div class=error id=emailError>Required: Please enter your email address<br></div><br><input type=submit value=Submit style="margin-left: 50px"></form> PLESAE, PLEASE help!Thank you inadvance.
  7. Hello.I've been searching for this so many days and could not found any.I'd like to have my form validation similar to Ajax "ValidatorCallout"1. When user left required field(s) left blank, then highlight the required field(s).2. Instead of alret popup, error message will show right next to required field, one at a time start from the first required field and as it fills in.This error message box shold have "close" function. I assume that using CSS.3. Although it's highlighted ALL required fields, and show the error message at the first required field,user might be left first field and click the second(or any other required field) field, then show the error message for that field.Error message could be able to up and down as user click whichever required field.Basically, I'd like to add just like how Ajax "ValidatorCallout" works.I have two basic validation codes. I can use either this; if (!document.addform.title.value){ alert('Please specify the title.); document.addform.title.focus(); return false;} Or, I can use this; function checkForm() {name = document.getElementById("name").value;email = document.getElementById("email").value;if (name == "") {hideAllErrors();document.getElementById("nameError").style.display = "inline";document.getElementById("name").select();document.getElementById("name").focus();return false;} else if (email == "") {hideAllErrors();document.getElementById("emailError").style.display = "inline";document.getElementById("email").select();document.getElementById("email").focus();return false;} return true;} function hideAllErrors() {document.getElementById("nameError").style.display = "none"document.getElementById("emailError").style.display = "none"} Please help. I've been working really hard to find sources.Thank you in advance.
×
×
  • Create New...