Version 1.6.4 is now online. One major upgrade, you can now validate from any function in your script. You are no more bounded to the custom regex engine. And a minor update, you can now click on the bubble to make them disappear, in case they are in the way.

Here how it works:

In your field add:

<input value=""  class="validate[required,funcCall[validate2fields]] text-input" type="text" id="lastname" name="lastname"  />

In your language js file have something like (nname is the function name to call):

"validate2fields":{
    					"nname":"validate2fields",
    					"alertText":"* You must have a firstname and a lastname"}	
					}

Now the custom function that could be anywhere in your JS

	function validate2fields(){
			if($("#firstname").val() =="" || $("#lastname").val() == ""){
				return true;
			}else{
				return false;
			}
		}

Grab it here.

19 thoughts on “Form Validation Engine 1.6.4

  1. Great. I like that.
    Can you let me know what could be the custom rule regex expression that I could add to the engine for “The field must contain at least an alphabet and a number.”
    Thanks in advance.
    Zullu.

  2. Added range[min,max] for numbers:

    “length”: {
    “regex”: “none”,
    “alertText”: “• Between “,
    “alertText2″: ” and “,
    “alertText3″: ” characters allowed”
    },
    “range”: {
    “regex”: “none”,
    “alertText”: “• Numeric value between “,
    “alertText2″: ” and “,
    “alertText3″: ” allowed”
    },
    “maxCheckbox”: {
    “regex”: “none”,
    “alertText”: “• Checks allowed Exceeded”
    },

    and

    function _range(caller, rules, position) { // VALIDATE RANGE

    customRule = rules[position];
    startRange = eval(rules[position + 1]);
    endRange = eval(rules[position + 2]);

    pattern = eval(“/^[0-9\ ]+$/”);//$.validationEngine.settings.allrules[customRule].regex);

    if (!pattern.test($(caller).attr(‘value’))) {
    $.validationEngine.isError = true;
    promptText += $.validationEngine.settings.allrules[“range”].alertText + startRange + $.validationEngine.settings.allrules[“range”].alertText2 + endRange + $.validationEngine.settings.allrules[“range”].alertText3 + “”
    }
    else {
    fieldValue = $(caller).attr(‘value’);

    if (fieldValue endRange) {
    $.validationEngine.isError = true;
    promptText += $.validationEngine.settings.allrules[“range”].alertText + startRange + $.validationEngine.settings.allrules[“range”].alertText2 + endRange + $.validationEngine.settings.allrules[“range”].alertText3 + “”
    }
    }
    }


    case “length”:
    _length(caller, rules, i);
    break;
    case “range”:
    _range(caller, rules, i);
    break;

    Hope this helps

  3. Hi – I’m new to the jquery – so maybe this has already been answered… But how would I use your validation plugin in a ‘Tab’ UI?
    I’m testing now and when I switch to different tabs – the validation messages don’t change?

    Thanks

    Paul

  4. Thanks for this great plugin!

    Most of the time I have no problems. Unfortunately, I am now faced with a form that uses a regular button instead of a submit button. Is there a way to trigger the validation process without a submit button?

  5. Nevermind, figured it out!

    var valid = $(“#formID”).validationEngine({returnIsValid:true});

  6. Awesome plugin!

    Upon upgrading, I get this error in jquery.validationEngine.js:

    $(this).find(“[class*=validate][type!=checkbox]”).live is not a function

    Any ideas? Thanks much!

  7. I have some problems in range function how can use it please help me as fast as possible

    thanks for interest

  8. Hello Cedric Dugas
    I am very happy to get such a great jquery validation but I could not able to valide dropdown list why ?
    is there any problem way to validater dropdown list ?

    Please give some advice to solve it

    Again thanks for your such great validation

  9. I am trying to use your validation plugin along with a tabbing system I wrote, but I can’t get the tabbing to stop from going to the next step if there is an error generated from the form.

    Any ideas on pointing me in the right direction for this?

  10. I want to create a generic method to validate URLs
    can i pass a parameter (in my case i need the element ‘this’) from the class definition?
    or i need to write a method to each url field i want to validate and get the field value using jquery?

    Thanks

  11. Yes, I’d love to know if we can pass a value along in funcCall to determine what element was the trigger (having access to $(this) would be great).

    Thanks,
    Matt

  12. it works well in localhost but when run in the bowser it shows….validateEngine is not a function..How to fix it??

Comments are closed.