1

I'm using the validation class in .net to validate my form.

if (Validation.IsValid()){
            //do something if the form is valid
        }

I'm trying to disable the submit button by using javascript if it's valid. How can I check if my form validation status in javascript/jquery?

UPDATE I'm using System.Web.WebPages. Not System.Web.UI for my namespace

2

1 Answer 1

0

To answer your direct question, there is a javascript variable supplied by the webforms validation api:

Page_IsValid

so you can use something like

if(Page_IsValid)
{
    //Page already submitted logic.
}

For more info see: https://techbrij.com/client-side-validation-using-asp-net-validator-controls-from-javascript , which delves further into the api and is well worth a look.

Sign up to request clarification or add additional context in comments.

1 Comment

It shows me error when i use Page_IsValid in my javascript/jquery

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.