Hi
is there any way i can call a clientside function for validation onClick of
a Image or imagebutton?
Right now my image or imagebutton is submitting to the server, even it
return false from the clientside function.
my sample code has,
..aspx code:
-------------
function validateme()
{
if ((document.Form 1.pwdOldPwd.val ue != "") ||
(document.Form1 .pwdNewPwd.valu e != "") || (document.Form1 .pwdRenterPwd.v alue
!= ""))
{
if (document.Form1 .pwdOldPwd.valu e == "")
{
htlOldPwd.inner Text = "Old Password Required";
document.Form1. pwdOldPwd.focus ();
return false;
}
else
htlNewPwd.inner Text = " ";
}
else
htlNewPwd.inner Text = " ";
return true;
}
<input type="image" id="imgSubmit" src="images/bt_changepasswo rd.gif"
runat="server" onServerClick = "submitme">
codebehind:
--------------
'imgSubmit.Attr ibutes.Add("onC lick", "if ( validateme() ) ")
Any ideas??
Thanks
Ganesh kolappan.
is there any way i can call a clientside function for validation onClick of
a Image or imagebutton?
Right now my image or imagebutton is submitting to the server, even it
return false from the clientside function.
my sample code has,
..aspx code:
-------------
function validateme()
{
if ((document.Form 1.pwdOldPwd.val ue != "") ||
(document.Form1 .pwdNewPwd.valu e != "") || (document.Form1 .pwdRenterPwd.v alue
!= ""))
{
if (document.Form1 .pwdOldPwd.valu e == "")
{
htlOldPwd.inner Text = "Old Password Required";
document.Form1. pwdOldPwd.focus ();
return false;
}
else
htlNewPwd.inner Text = " ";
}
else
htlNewPwd.inner Text = " ";
return true;
}
<input type="image" id="imgSubmit" src="images/bt_changepasswo rd.gif"
runat="server" onServerClick = "submitme">
codebehind:
--------------
'imgSubmit.Attr ibutes.Add("onC lick", "if ( validateme() ) ")
Any ideas??
Thanks
Ganesh kolappan.
Comment