SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Who submitted the form?

    I have a form,
    It has multiple submit buttons (Save/Quit)
    I want my form calidation to run when I save and not when I quit.
    I still want to submit the form when I quit.

    So how do I conditionally run the validation?

    Ta,
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="button" value="Save" onclick="if( validateForm() ) this.form.submit();">
    <input type="submit" value="Quit" />
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by beetle
    <input type="button" value="Save" onclick="if( validateForm() ) this.form.submit();">
    <input type="submit" value="Quit" />
    Cool - that almost worked. The only problem with that is, it doesn't post the button value with the form. Is that something to do with calling submit manually? Anyway as it turned out the following worked just fine.
    <input type="button" value="Save" onClick=" return validateForm(this.form);">
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •