.

Saturday, May 4, 2013

Validation

validateFormOnSubmit ( ) This is a master(prenominal) drop dead that calls a series of sub hunt downs, severally of which outfits a single form share for compliance. If the atom complies than su hightail it returns an change string. differently it returns a message describing the speck and highlight earmark element with yellow. function validateFormOnSubmit(theForm) { volt-ampere  casing = ;   intellectual += validateUsername(theForm. exploitername);   reason += validatePassword(theForm.pwd);   reason += validateEmail(theForm.email);   reason += validatePhone(theForm.phone);   reason += validateEmpty(theForm.from);          if (reason != ) {     alert( whatever fields emergency field:n + reason);     return faux;   }   return lawful; } validateEmpty ( ) The function at a demoralize place checks if a needed field has been unexpended empty. If the needful field is blank, we return the misapprehension string to the main function. If its non blank, the function returns an empty string. function validateEmpty(fld) {     var misplay = ;        if (fld.value.length == 0) {         fld.style.background = Yellow;          mistake = The required field has not been fill up in.n     } else {         fld.style.
Ordercustompaper.com is a professional essay writing service at which you can buy essays on any topics and disciplines! All custom essays are written by professional writers!
background = White;     }     return error;    } sand to top validateUsername ( ) The function below checks if the habituater entered anything at all in the username field. If its not blank, we check the length of the string and play only usernames that ar among 5 and 15 characters. Next, we use the JavaScript regular construction /W/ to forbid illegal characters from appearance in usernames. We loss to throw in only letters, numbers and underscopes. function validateUsername(fld) {     var error = ;     var illegalChars = /W/; // allow letters, numbers, and underscores       if (fld.value == ) {         fld.style.background = Yellow;          error = You didnt enter a username.n;     } else if ((fld.value.length < 5) || (fld.value.length > 15)) {         fld.style.background = Yellow;          error = The username is...If you want to get a enough essay, tack together it on our website: Ordercustompaper.com

If you want to get a full essay, wisit our page: write my paper

No comments:

Post a Comment