Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--Validation
- function validatePositiveDecimalsOnly(e) {
- if (e.keyCode != 46 && e.keyCode > 31
- && (e.keyCode < 48 || e.keyCode > 57))
- return false;
- }
- function validateNumbersOnly(e) {
- if ((e.keyCode < 48) || (e.keyCode > 57)) {
- return false;
- }
- }
- function validatePhoneNumber(e) {
- if ((e.keyCode < 48) || (e.keyCode > 57)) {
- if ((e.keyCode != 40) && (e.keyCode != 41) && (e.keyCode != 45))
- return false;
- }
- }
- function validateEmail(email) {
- var emailFormat = email.slice(email.indexOf('@'), email.length);
- if (email.indexOf('@') == -1 || emailFormat.indexOf('.') == -1) {
- if (email.length !== 0) {
- return false;
- }
- else {
- return true;
- }
- }
- else {
- return true;
- }
- }
- function isNumeric(val) {
- var numeric = true;
- var chars = "0123456789";
- var len = val.length;
- var char = "";
- for (i = 0; i < len; i++) {
- char = val.charAt(i);
- if (chars.indexOf(char) == -1) {
- numeric = false;
- }
- }
- return numeric;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement