php - Validate inputs with jQuery -
objective:
validate input form. if okay, submit it, otherwise return error user.
problem:
i want validate inputs in form, don't know how cleanly.
how can validate form safely without heavy validation libraries?
try this:
function validate() { if (validatefield(document.form.field1) && validatefield(document.form.field2) && validatefield(document.form.field3) && validatefield(document.form.field4) && validatefield(document.form.field5)) return true; else return false; } function validatefield(field) { //your condition of validation }
Comments
Post a Comment