Hi,

I am trying to call/execute a jQuery function inside of another jQuery
function, the scenario is after validation of a input text field to
check if its empty, if empty display a error message and if it has
value then execute another function, the code as below, adapted from
this link

http://yensdesign.com/2009/01/how-validate-forms-both-sides-using-php-jquery/

var name = $("#label");
var nameInfo = $("#nameInfo");
 //On blur
 name.blur(validateName);
 //On key press
 name.keyup(validateName);
 $("#addPhoneExt").click(validateName);
 //On Submitting
        //$("#addPhoneExt").click(function(){
                //if(validateName())
                        //return true
                //else
                        //return false;
        //});

        function validateName(){
                //if it's NOT valid
                if(name.val().length < 4){
                        name.addClass("error");
                        nameInfo.text("We want names with more than 3 
letters!");
                        nameInfo.addClass("error");
                        return false;
                }
                //if it's valid
                else{
                        $('#addPhoneExt').click(addPhoneExt);
                        name.removeClass("error");
                        nameInfo.text("What's your name?");
                        nameInfo.removeClass("error");
                        //$('#addPhoneExt').click(tb_remove);
                        return true;
                }
        }

With the above code I am able to validate the input field but what I
need is to execute or call the "addPhoneExt" "tb_remove" (function to
close thickBox) function //if its valid.

Appreciate your help.

Thanks!

Reply via email to