SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Location
    Lincolnton
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Submit to different forms depending on button selected

    Hi, got a small problem here. I have a postcard site and I would like to do the following.

    I want to use a single <form> for the card creations, but I also want to offer a preview pane in a new window if they want preview the card.

    For example, if they click the "Preview" button a new window pops up (preview.phtml) with a preview of their card with all their selections showing.

    If they click the "Send Now" button they are taken to the confirmation page (sent.phtml) that tells them that their card has been sent.

    Is this possible with one <form> tag?

    I tried setting up a javascript using document.write to dynamically write in the action= tagd depending on which input button they click but that doesn't seem to work.

    Any ideas?

  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <input type="submit" onclick="this.form.action='somepage';" value="Button1" />
    I think that would work. Alternatively, I think this could be done server-side, but I'd need to test something first...
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  3. #3
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Jeff's solution does work. See this thread for somewhat more of the same:
    http://www.sitepointforums.com/showt...hreadid=121832

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


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
  •