Alpha DevCon 2018
Results 1 to 9 of 9

Thread: Return to Previous URL (two screens ago)

  1. #1
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    986

    Default Return to Previous URL (two screens ago)

    Hi,

    I have seen on a past post (from Steve Wood) that you are able to go back to a previous page using the following;

    Code:
    It will work if you put this in your initialize event:
    
    if eval_valid("request.referer")
    session.page = request.referer
    else
    session.page = "anerrorpage.a5w"
    end if 
    
    and this in your aftervalidate:
    
    CurrentForm.RedirectTarget= session.page
    
    You only need the else..errorpage.a5w part if you want, probably not necessary under normal circumstances.
    However, what i am trying to achieve is slightly different.

    1. The user selects the search Grid (Page 1) and say lists all companies beginning with A
    2. Then the user selects one of the companies, this sends them to a contacts page (Page 2)
    3. The user then selects the contact and a dialog appears (Page 3).
    4. The user adds some data within the dialog form and then submits the page.
    5. I now want to return to the first grid result page (Page 1).

    I can redirect back to that page, but i will loose the filter results. I want to be able to get back to page 1 complete with the results from the initial filter. I suppose it would be like clicking BACK twice.

    Can anyone help?

    Thanks

    Denis

  2. #2
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    986

    Default Re: Return to Previous URL (two screens ago)

    I managed to sort it.

    I created another a5w page with some javascript code and redirected my dialog to that.

    Code:
    <script language="JavaScript" type="text/javascript">
    javascript:window.history.go(-3);
    </script>
    Denis

  3. #3
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    986

    Default Re: Return to Previous URL (two screens ago)

    Hi,

    Due to some additional screen clicks in between Page 1 and 3, the javascript go back 3 screens is not always appropriate. Does anyone know a way where i could specifically specify the page to return back to.

    Denis

  4. #4
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,787

    Default Re: Return to Previous URL (two screens ago)

    On the page you want them to go back to, set:

    session.pageiwant=Request.Script_Name

    script_name is the name of the page they are on, like "index.a5w".

    Then use that session variable in a link or response.redirect() on the page you want them to bounce back from. To recreate the initial filter you can either, depending on how you filtered in the first place:

    - on the original page, save the filter text to another session variable and then reapply as a page variable when they go back. (Not sure how you would do the first page, depends on how you set the filter).
    - take a look at the URL on the original page. IF that URL includes the filter syntax, then user request_uri instead of script_name and it will include the filter syntax.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  5. #5
    Member
    Real Name
    Denis Ahmet
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    986

    Default Re: Return to Previous URL (two screens ago)

    Thanks for the reply Steve,

    Where on the return (original) screen should I place session.pageiwant = Request.Script_Name.

    Denis

  6. #6
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,787

    Default Re: Return to Previous URL (two screens ago)

    Anywhere. Inserting it at the top is best.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  7. #7
    Member
    Real Name
    Jim
    Join Date
    Aug 2014
    Posts
    21

    Default Re: Return to Previous URL (two screens ago)

    Hi all ,

    The page that I'm supposed to add "session.pageiwant = Request.Script_Name" at the top is a page with "requires login" security, so I apparently the code, "session.pageiwant = Request.Script_Name" didn't get transacted before I was directed to my login page.

    SecurePage.a5w
    1. Add "session.pageiwant = Request.Script_Name" at the top

    LoginPage.a5w
    1. After successful login, redirect as session.pageiwant

    Anywhere else I can get "session.pageiwant = Request.Script_Name" transacted before I'm directed to my login page ?

    Thanks.

  8. #8
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,787

    Default Re: Return to Previous URL (two screens ago)

    Jim,

    This is a six year old thread. I am sure the desired method has changed -- please start a new discussion and tell us what you are trying to accomplish.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  9. #9
    Member
    Real Name
    Jim
    Join Date
    Aug 2014
    Posts
    21

    Default Re: Return to Previous URL (two screens ago)

    Hi Steve,

    ok, here's the new thread.

    http://msgboard.alphasoftware.com/al...146#post678146

    Thanks.

Similar Threads

  1. Return to previous serach value for a grid
    By richardurban in forum Web Application Server v7
    Replies: 2
    Last Post: 08-26-2008, 09:12 PM
  2. Help Screens
    By Paul Main in forum Alpha Five Version 8
    Replies: 1
    Last Post: 02-06-2008, 02:09 PM
  3. Return to a previous page
    By Ezslim in forum Application Server Version 8
    Replies: 2
    Last Post: 09-10-2007, 09:47 AM
  4. return to previous window
    By Cheryl Lemire in forum Alpha Five Version 6
    Replies: 20
    Last Post: 09-22-2004, 07:50 AM
  5. New to Alpha... Used Shareware Version 15+ yrs ago
    By Chris Anders in forum Alpha Five Version 4
    Replies: 2
    Last Post: 02-07-2002, 01:47 PM

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
  •