SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast nosnevel's Avatar
    Join Date
    Aug 2003
    Location
    US
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prevent going BACK on multi-page form

    I have a 4-page application that users fill out online. Works fine. . . as long as they don't click the "Back" button.

    Is there a way to disable the back button? Is there a better way to handle a multipage form?

    Larry
    Larry Levenson
    Sigma Web Technologies - Prescott Valley, AZ, USA
    http://www.SigmaWebTechnologies.com

  2. #2
    public static void brain Gybbyl's Avatar
    Join Date
    Jun 2002
    Location
    Montana, USA
    Posts
    647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could set some kind of cookie or session variable that corresponds to the highest page of the form that the user has seen, and then add logic on all of the other pages that looks for this variable, compares it to their own number, and does an http redirect which puts them back on the correct page.

    This seems like it should work, on first thought. Don't know if it will hold up under scrutiny, though.
    Ryan

  3. #3
    Non-Member
    Join Date
    Jan 2004
    Location
    Planet Earth
    Posts
    1,764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Put the counter within a HIDDEN field for example, which is incremented and passed to the next form ?

    Then compare against the SESSION and redirect if required, as suggested ?

  4. #4
    SitePoint Enthusiast nosnevel's Avatar
    Join Date
    Aug 2003
    Location
    US
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Gybbyl
    You could set some kind of cookie or session variable that corresponds to the highest page of the form that the user has seen...
    Session variable could work. . . some people turn off cookies. So it could be
    Code:
     if ($_SESSION[page] = 2) {//redirect to page 3}
    for example.

    This might work. Anyone see a problem with the logic?? Is there another solution that someone has experience with?
    Larry Levenson
    Sigma Web Technologies - Prescott Valley, AZ, USA
    http://www.SigmaWebTechnologies.com

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Widow Maker
    Put the counter within a HIDDEN field for example, which is incremented and passed to the next form ?

    Then compare against the SESSION and redirect if required, as suggested ?
    I personally prefer the idea of using a hidden form field and have used such a method in the past in multi-page wizards and forms.

  6. #6
    SitePoint Guru OfficeOfTheLaw's Avatar
    Join Date
    Apr 2004
    Location
    Quincy
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by nosnevel
    I have a 4-page application that users fill out online. Works fine. . . as long as they don't click the "Back" button.

    Is there a way to disable the back button?

    Larry
    You really need to look back over your design and correct that problem rather than impose navigational restrictions on the users.


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
  •