Validate Now

Example

Version update history

1.0.11 - 3/4/2021

- When checking for the fields that are required will no longer count spaces to prevent a single/multiple spaces in the field from returning a valid response


1.0.10 - 7/14/2020

- Corrected issue with checking required radio input will now check if any radio button is checked instead of just the last one


1.0.9 - 7/10/2020

- Updated the Expression for "date" to allow xx/xx/xxxx or x/x/xxxx

- Will re-validate input elements on change event in addition to keyup


1.0.8 - 7/7/2016

- Corrected issue with placing "error label" between radio/checkbox input elements and its label


1.0.7 - 11/23/2015

- Corrected issue with data-validateNow-required being required even if undefined


1.0.6 - 6/23/2015

- Added standardExpression ("decimal")


1.0.5 - 6/16/2015

- Added standardExpression ("number")

- span is no longer required data-validatenow- can now be placed directly on the element (This is still in beta and and not tested with browsers earlier than IE11)


1.0.4 - 8/20/2014

- Corrected issue with data-validateNow-required being required even when set to false


1.0.3 - 6/6/2014

- Added standardExpression ("uscurrency")

- Now add attr to fields with "data-validateNow-isValid" with true or false


1.0.2 - 5/5/2014

- Added support for HTML5 input types ("color","date","datetime","datetime-local","email","month","number","range","search","tel","time","url","week")

- Updated the "checkregularExpression" function to allow easy additions of standardExpressions

- Added standardExpression ("SSN", "phone")


1.0.1 - 3/3/2014

- Will not check fields that are not visible


<script type="text/javascript">

$(document).ready(function () {

$("#submit").click(function () {

$(".VAL").validateNow(function (noErrorsFound) {

if (noErrorsFound) {

//Save data here

} else {

alert("Please correct the errors and try again")

}

});

});

});

function customFunction(oInput) {

if ($(oInput).val() == "This value") {

return "Message"[or] false;

} else {

return ""[or] true;

}

}

</script>

<label for="BirthDate">Birth Date:</label>

<input type="text" id="BirthDate" />

<span

data-validatenow-fieldid="BirthDate"

data-validatenow-required="true"

data-validatenow-RegularExpression="Date"

class="val"></span><br/>


<label for="BirthDate">Birth Date:</label>

<input class="val" type="text" id="BirthDate"

data-validatenow-required="true"

data-validatenow-RegularExpression="Date"/>


<label for="BirthDate">Birth Date:</label>

<input class="val" type="text" id="BirthDate"

data-validatenow-customFunction="customFunction"/>