myForm.send inside event onAfterValidate...

When I click on my save button and call this line:
myForm.validate();
I expect this event to do the required save logic after validations pass:

myForm.attachEvent(“onAfterValidate”, function (status) {

        alert(status);//this is true in case of valid entry
        if (status == true) {

            $("#transMaskDiv").mask("Saving...");
            alert('saving...');
            myForm.send("/PO_ASSET/SaveMain", "post", function (loader) {
                alert('saved...');    
                dhtmlx.message.defPosition = "top";            
                dhtmlx.message({ text: rows[0].getAttribute("message"), lifetime: 2000, type: rows[0].getAttribute("action_type") });
                $("#transMaskDiv").unmask();

            });
        }
    });

    myForm.attachEvent("onValidateError", doCustomErrMsg);

    function doCustomErrMsg(name, value, res) {
        if (name == "ExRate") {
            alert("Invalid value (" + value + ") specified for " + name + "! A Number is required!");
            return false;
        }
        //alert(name);
    }

But even if there’s no error in inputs alert(‘saving…’); pops up recursively and the flollowing line never run:
myForm.send("/PO_ASSET/SaveMain", “post”, function (loader) {
alert(‘saved…’);
What’s wrong with my save logic?

When you call send() method, validate() method automatically called and request is blocked if validation failed. Thant’s why recursion occurred, “onAfterValidate” event is called each time you call send() method inside “onAfterValidate” event handler.

Ok.