Click here to Skip to main content
15,887,467 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all,
i have one user profile page in my project
on its save button, onclient click i am calling a javascript function and in the same page there is a field of password that is mandatory, i have used required field validator and validation group is as same as save button but its not working due to client click javascript function. it i remove it it is working. i want to keep both ..
please suggest me a better way...

here is that button code:-

ASP.NET
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/buttons/save.jpg" 
                                          onclick="ImageButton3_Click" ValidationGroup="Submit" OnClientClick="return CheckForTestFile();" />

only return CheckForTestFile(); working well
but ValidationGroup="submit" not working

thanks in advance
Posted
Updated 2-Apr-12 1:48am
v3
Comments
Mario Majčica 2-Apr-12 7:05am    
Please show some code, otherwise is difficult to help you.
betu.009 2-Apr-12 7:31am    
have shown you that code
[no name] 2-Apr-12 7:44am    
//call both function at a time..

<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/buttons/save.jpg"
onclick="ImageButton3_Click" OnClientClick="return ValidatePassword(),CheckForTestFile();" />

//this is ur required field validator function//
function ValidatePassword() {
window.ValidatorValidate(window.idofyourrequiredfieldvalidator);
var valid = window.idofyourrequiredfieldvalidator.isvalid;
alert(valid);
return true;
}

//Hope it helps
[no name] 2-Apr-12 8:16am    
Ridiculous. No reason to use two methods.

1 solution

Use this in the client-side method to trigger the validators
VB
if(typeof (Page_ClientValidate) == 'function')
    Page_ClientValidate();
if(!Page_IsValid)
{
  // Do something
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900