SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,531
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Changing Form Submit to Redirect

    Is there a way to take this form submit button...

    Code HTML4Strict:
    <!-- Submit Form -->
    <li>
    	<input type="submit" name="addArticle" id="addArticle" value="Add Article"/>
    </li>

    ...and turn it into a "Add Another Record" button that is styled the same way but that re-directs the user back to the same page but my HTML "Add an Article" form?

    I've done this lots in the past with Image Buttons, but am looking for a different approach using my browser's built-in buttons (or whatever).

    Thanks,


    Debbie

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    151 Post(s)
    Tagged
    3 Thread(s)
    Little bit of Javascript should do it
    Code:
    <script type="text/javascript" language="javascript">
        function redirect()
        {
            location.href = "http://www.yoursite.com/addanotherrecord";
        }
    </script>
    Code:
    <input type="button" value="Add Another Record" onclick="redirect();" />
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,531
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spikeZ View Post
    Little bit of Javascript should do it
    Code:
    <script type="text/javascript" language="javascript">
        function redirect()
        {
            location.href = "http://www.yoursite.com/addanotherrecord";
        }
    </script>
    Code:
    <input type="button" value="Add Another Record" onclick="redirect();" />
    Thanks, but how about without JavaScript?

    (What happens when a user's JS is off?!)

    Maybe I just need to go back to my image buttons - which is fine - except that I wanted a button that looks like the "Submit" button the browser already provides.


    Debbie

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,401
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    I'm not sure I understand your question. Can you give an example of how you do it with image buttons?

  5. #5
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,531
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    I'm not sure I understand your question. Can you give an example of how you do it with image buttons?
    Like this...

    Code HTML4Strict:
    <li>
    	<a href="' . WEB_ROOT . 'log_in.php">
    		<img src="' . WEB_ROOT . 'buttons/SignIn2.png" alt="Sign In" />
    	</a>
    </li>


    Debbie


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
  •