3

I have a basic CRUD form that uses PageMethods to update the user details, however the Validators don't fire off, I think I need to manually initialize the validators and check whether the validation has passed in my javascript save method. Any ideas on how to do this?

3 Answers 3

1

Ok so I finally solved this: You need to call Page_ClientValidate() in your Save javascript method and If it returns true continue with the save, the Page_ClientValidate() initiates the client side validators, See code below:

    function Save()
    {
        var clientValidationPassed =Page_ClientValidate();
        if(clientValidationPassed)
        {
            //Save Data
            PageMethods.SaveUser(UserName,Role,SaveCustomerRequestComplete, RequestError);
            $find('editPopupExtender').hide();
        }
        else
        {
            //Do Nothing as CLient Validation messages are now displayed
        }
        return false;
    }
Sign up to request clarification or add additional context in comments.

Comments

0

what are you using for development? VS 2008 supposedly has better JS debugging, haven't tried it yet.

For Ajax you can use the Sys.Debug obj

Comments

0

If you use Firefox, you can use the FireBug plugin. It has great javascript debugging support.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.