image/imagebutton client validation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ganesh kolappan

    #1

    image/imagebutton client validation

    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.




  • Karl Seguin

    #2
    Re: image/imagebutton client validation

    Have you looked at client-side customvalidator s?
    http://msdn.microsoft.com/library/de...datorclass.asp

    Karl

    "ganesh kolappan" <hookit2000@yah oo.com> wrote in message
    news:OeW4foXQDH A.2832@TK2MSFTN GP10.phx.gbl...[color=blue]
    > Hi
    >
    > is there any way i can call a clientside function for validation onClick[/color]
    of[color=blue]
    > 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 != "") ||[/color]
    (document.Form1 .pwdRenterPwd.v alue[color=blue]
    > != ""))
    > {
    > 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.
    >
    >
    >
    >[/color]


    Comment

    • David Waz...

      #3
      image/imagebutton client validation

      ....attribute.a dd("OnClick","r eturn validateMe();")
      [color=blue]
      >-----Original Message-----
      >Hi
      >
      >is there any way i can call a clientside function for[/color]
      validation onClick of[color=blue]
      >a Image or imagebutton?
      >Right now my image or imagebutton is submitting to the[/color]
      server, even it[color=blue]
      >return false from the clientside function.
      >
      >my sample code has,
      >..aspx code:
      >-------------
      >function validateme()
      > {
      > if ((document.Form 1.pwdOldPwd.val ue != "") ||
      >(document.Form 1.pwdNewPwd.val ue != "") ||[/color]
      (document.Form1 .pwdRenterPwd.v alue[color=blue]
      >!= ""))
      > {
      > 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"[/color]
      src="images/bt_changepasswo rd.gif"[color=blue]
      >runat="serve r" onServerClick = "submitme">
      >
      >codebehind:
      >--------------
      >'imgSubmit.Att ributes.Add("on Click", "if ( validateme[/color]
      () ) ")[color=blue]
      >
      >Any ideas??
      >
      >Thanks
      >
      >Ganesh kolappan.
      >
      >
      >
      >
      >.
      >[/color]

      Comment

      Working...