help with onclick submit

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

    #16
    Re: help with onclick submit

    John said:[color=blue]
    >
    >
    >"Lee" <REM0VElbspamtr ap@cox.net> wrote in message
    >news:dhf78d04f 5@drn.newsguy.c om...
    >[color=green]
    >> Well, if you're not actually submitting anything, don't freaking use
    >> a submit button. Use a regular button.
    >>[/color]
    >
    >It *is* submitting something, an email address. But if the email address is
    >"email" I want it blank.[/color]

    If you're submitting, and you want something to happen first, and/or
    you want the submission to be cancelled under certain circumstances,
    then use the onsubmit handler of the form. Do NOT use the onclick
    handler of the submit button.

    Comment

    • Evertjan.

      #17
      Re: help with onclick submit

      ASM wrote on 29 sep 2005 in comp.lang.javas cript:
      [color=blue]
      > <form action="foo.htm "
      > onsubmit="if(th is.email.value= ='e-mail'){
      > this.email.valu e='';
      > return false;
      > }
      > else[/color]

      no need for the else here!
      [color=blue]
      > return true;">
      > <input type=text name="email" value="e-mail">
      > <input type=submit value=GO>
      > </form>
      >[/color]

      even shorter is:

      onsubmit="
      if(this.email.v alue!='e-mail')
      return true;
      this.email.valu e='';
      return false;"


      --
      Evertjan.
      The Netherlands.
      (Replace all crosses with dots in my emailaddress)

      Comment

      Working...