0

hi
my page contains a button with a javascript click event.
when i click the button i want to check if the page is valid, and if the answer is yes, to perform the event function. if the page is not valid i want the error message to show in the page's validation summary.

i tired a few code lines:

function btnLogin_Click()
     {
       if (AllValidatorsValid(Page_Validators))
       { 
        var a = document.getElementById('ctl00_ContentPlaceHolder1_txt1').value;
        var b = document.getElementById('ctl00_ContentPlaceHolder1_txt2').value;
       
        alert(a + " " + b);
       }
     }

i also tried:

if (Page_isValid)
{
 ....
}

nothing seems to work.

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by emilio
0

found the answer.

if (Page_ClientValidate("g1"))
{
.....
}

g1 is the validation group.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.