Simple form validation using javascript from the scratch

Pubblicato il: 10 dicembre 2014
sul canale di: Shreekrishna
37,640
194

I am really sorry because this video was recorded too early and without any features of pausing the recording but I have provided the codes below..

This is the basic form validation using javascript.. It is created from the scratch with HTML5. The Basics of HTML and Javascript..

onsubmit_event.js

// Below Function Executes On Form Submit
function ValidationEvent() {
// Storing Field Values In Variables
var name = document.getElementById("name").value;
var email = document.getElementById("email").value;
var contact = document.getElementById("contact").value;
// Regular Expression For Email
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
// Conditions
if (name != '' && email != '' && contact != '') {
if (email.match(emailReg)) {
if (document.getElementById("male").checked || document.getElementById("female").checked) {
if (contact.length == 10) {
alert("All type of validation has done on OnSubmit event.");
return true;
} else {
alert("The Contact No. must be at least 10 digit long!");
return false;
}
} else {
alert("You must select gender.....!");
return false;
}
} else {
alert("Invalid Email Address...!!!");
return false;
}
} else {
alert("All fields are required.....!");
return false;
}
}


In questa pagina del sito puoi guardare il video online Simple form validation using javascript from the scratch della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Shreekrishna 10 dicembre 2014, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 37,640 volte e gli è piaciuto 194 spettatori. Buona visione!