SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2004
    Location
    Boston
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    redirect HTML form to page other than action=""

    Hello,

    I have a form in which i need to redirect somewhere other than where the form is submitted to. Is this possible with javascript? I'm not a javascript programmer so I need help.

    I basically have a form that adds the submission to Google groups but instead of the default google groups page I want it to redirect back to my site.

    Here is a sample of my code:

    HTML Code:
      <form id="info" method="post" onSubmit="window.location='http://mysite.com'" action="http://groups.google.com/group/mygroup/boxsubscribe">
      <input type="hidden" name="hl" value="en">
      
    	<input id="uremail" type="text" value="email" name="email" size="29"/>
    		<input type="submit" id="usent" name="submit" value="Send" />
    	</form>
    I've also tried adding this:

    HTML Code:
     <input type="hidden" name="redirect" value="www.mysite.com">
    thanks in advance for any help.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Do you still want the form to be submitted to google groups, as well as having the person being redirected back to your site?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2004
    Location
    Boston
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, basically it adds a member to the google group but I don't want to see the ugly google pages..

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Rmazin View Post
    Yes, basically it adds a member to the google group but I don't want to see the ugly google pages..
    One way is to use the onsubmit event to open a new window to your web site. That's normally the best way because then the person can still go back and find out about the group they were subscribed to.

    If you want to hide things further than that, you're going to be forced to do things asynchronously, by using some AJAX techniques to submit the form, and on a successful submission to then navigate to a different page.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •