Alpha Video Training
Results 1 to 12 of 12

Thread: How do I "Go Back To Previous Page" after a Submit?

  1. #1
    Member
    Real Name
    Tom Williams
    Join Date
    Oct 2007
    Posts
    424

    Default How do I "Go Back To Previous Page" after a Submit?

    I want to be really clear here with my question because often I've seen answers on this forum that are "close to" the question asked but not really on target.

    My question is presented in it's simplest form and readers should not read into it more than what is said.

    I'm working with web grids at the moment and want to "Go Back To Previous Page" after a Submit?" It should work just like the Browser "BACK" button, no better, no worse. Doesn't need to be "smart" etc. JUST GO BACK!

    Is there a simple procedure in A5V8 that simply does this? Please, no responses that talk about saving previous page identity etc. It can't be that complex. If this is a web product then it Has To have a Go BACK FUNCTION.

    Thanks!

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

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    If your grid has a Submit button, you also have an Update Settings section on your grid. See the Target Page property, which defaults to <self>. Change that to the page you want them to go back to and, when they cliick Submit it will process the records and go to that page.

    If you need it to be dynamic, and you never know the name of the page you want them to go back to, then that won't work because it demands a specific page name.

    Also, just to explain in advance why (if the above won't work for you) the next post could be more complex and not satisfy your rigid requirements for a simple answer, as soon as they press Submit, the previous page becomes the grid itself.
    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)

  3. #3
    Member
    Real Name
    Tom Williams
    Join Date
    Oct 2007
    Posts
    424

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    As I tried to explain:

    I want a "Go Back To Previous Page" after a Submit? A function that acts JUST LIKE the Back Button in a browser.

    I knew my question would invite "too much thinking" and that was what I was trying to avoid. Both for my sake and for yours.

    Let me explain:

    As Steve mentions "Update Settings section on your grid" can take you back to the page you select. Unfortunately that is Not what a BACK button does in a browser. For example if I am sitting in a grid on a page called Browse-all.a5w and I'm on record 22 and the grid only displays five records at a time, then I am several "clicks" deep into that grid component.

    If that record # 22 has a link that takes me to page
    Edit-Detail.a5w and I make a change and submit it, and I follow your method, I would be returned to the proper page but I will be sitting on record number 1. I will NOT have record # 22's page re-displayed. The Back button will do exactly that, but the Update Settings option will not.

    I know how to write javascript to do what I want, but I can't figure out how to place javascript code into a Submit button validation.

    <script language="JavaScript">
    <!-- javascript:window.history.back(1); //-->
    </script>



    More importantly, I'm trying to also evaluate "just how" complete and robust A5 really. I assumed there would be a function (that I can't find) that does what I wanted that is NATIVE to this platform.

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

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    Your first post described a completely different scenario than the second! It's really important to describe the scenerio accurately. Most of us that try to answer questions drop in to Alpha to actually test out the solution. That's the only responsible way to respond if the issue is not completely obvious; and I did test it in this situation.

    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.

    And, although this code may appear to "save the previous pages' identity", it's not doing that. It is saving the URL of the page that made the call to your Edit-Detail page, or the page previous to the previous page under normal circumstances (when you press submit, the previous page becomes your Edit-Detail page.)
    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
    Tom Williams
    Join Date
    Oct 2007
    Posts
    424

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    Quote Originally Posted by Steve Wood View Post
    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
    Steve,

    Where do I create/use the initialize event. I can not find a place that refers to this event. Remember I am using a web grid which I then place on a A5 web page.

    Simarily I can not figure out where to place/find/use an aftervalidate event. Are we talking about a web
    component?

    I see a list of six or so OTHER events when I examine the outline view (the tree) of my component but none of them have names to which you refer.

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

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    Maybe we should back up, I assumed Edit-Detail was a Dialog component based on a few words in your description and because I would use a dialog in this case. That's one of the problems with not being-there.

    If the solution below does not work please describe the link, show all of the settings that you use to create the link. Show everything that is under the Link Properties for that field, and the Calculated Expression, if there is one.

    If your Link Address Type is a DetailView Link, ignore the solution below and write back.

    Solution:

    Add the following (in green) to the Edit-Detail.A5W page in Source just after the first <%a5 tag.

    <html>
    <head>
    <%a5
    Delete tmpl_Edit-Detail
    DIM tmpl_Edit-Detail as P
    dim session.ref as c
    if eval_valid("request.referer")
    if session.ref=""
    session.ref = request.referer
    end if
    end if

    ...


    Add the following to the AfterUpdateRecords in your Edit-Detail grid

    function AfterUpdateRecords as v (Args as P, PageVariables as P)
    with PageVariables
    response.redirect(session.ref)
    session.ref = ""

    end with
    end function

    Test this out, it works but I am not quite as confident as if the Edit-Detail was a Dialog. Dialogs have more control.
    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
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    Did that work?
    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)

  8. #8
    Member
    Real Name
    Tom Williams
    Join Date
    Oct 2007
    Posts
    424

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    Quote Originally Posted by Steve Wood View Post
    Did that work?
    Sorry for the delay, but I was called away on a critical personal matter.

    As far as your solution, No I do not believe it worked. I would need to have time to re-verify that but my "gut" remembers a sinking feeling after inputting the code and doing a test. I got very frustrated and had to get away from it for a while.

    Your solution however pointed out something to me that I thought was very insightful. It was MY BELIEF that a Dialog component would be used for simple data entry of one or two fields etc. Never thought of it as a container for a page that needed 30 - 40 fields on it. I thought that was what a Grid component was for. Especially if that data was coming right out of a table etc.

    I really don't see the connection between a Dialog component and a table.
    I'm apparently all "container fouled up". Doesn't a grid component go onto its own web page that A5 seems to create for it.

    If there is a connection between a dialog component and a table then it seems like there will be an awful lot of work to do to "GET" and "PUT" the data back and forth inside the table. That was the beauty of the GRID, I thought.

    You are right, the Dialog component seems to have more control but I can't fanthom why the Grid based web page can't have the same capabilities.

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

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    Believe me, I know how frustrating this can be!

    Give it a rest, then retry. I am sure it will work IF I understand what you are trying to do - which is almost always the biggest problem up on this forum.
    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)

  10. #10
    Member
    Real Name
    Tom Williams
    Join Date
    Oct 2007
    Posts
    424

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    Quote Originally Posted by Steve Wood View Post
    Solution:

    Add the following (in green) to the Edit-Detail.A5W page in Source just after the first <%a5 tag.

    <html>
    <head>
    <%a5
    Delete tmpl_Edit-Detail
    DIM tmpl_Edit-Detail as P
    dim session.ref as c
    if eval_valid("request.referer")
    if session.ref=""
    session.ref = request.referer
    end if
    end if

    ...


    Add the following to the AfterUpdateRecords in your Edit-Detail grid

    function AfterUpdateRecords as v (Args as P, PageVariables as P)
    with PageVariables
    response.redirect(session.ref)
    session.ref = ""

    end with
    end function

    Test this out, it works but I am not quite as confident as if the Edit-Detail was a Dialog. Dialogs have more control.
    I finally got back to this issue and found Steve's suggestion to be successful with one caveat.

    I had to eliminate the following two lines or I would receive and error msg.

    Delete tmpl_Edit-Detail
    DIM tmpl_Edit-Detail as P

    Something about not liking the '-'. Never figured that out but don't care now.

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

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    It probably would be better to rename your component to : "EditDetail", leaving out the dash, and put those lines back in. And rename any other occurance of "Edit-Detail" to "EditDetail".
    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)

  12. #12
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,649

    Default Re: How do I "Go Back To Previous Page" after a Submit?

    Hey Dude!

    The least you could do is say thank you! Steve solved a problem for you - despite your rather impatient tone. It always kills me when people demand that their question be answered "this way" and not "that way". They want the answer - but only within the terms of their (typically) erroneous preconceptions. Guys like Steve have a lot of knowlege and experience and they go out of their way to help others. They're not paid to do so. A modicum of gratitude might be in order. Geeze!

Similar Threads

  1. "The Print Shop 21" error on report submit
    By Scholin in forum Application Server Version 8
    Replies: 3
    Last Post: 10-16-2007, 11:40 PM
  2. Newbie ? - Move "Submit" Button
    By cafulford in forum Web Application Server v7
    Replies: 1
    Last Post: 01-16-2006, 09:32 AM
  3. Back-up routine includes "all" files
    By Ronald Anusiewicz in forum Archived Wishlist
    Replies: 4
    Last Post: 01-15-2005, 01:03 AM
  4. Previous not "locked" to "Auto"
    By Richard Froncek in forum Alpha Five Version 5
    Replies: 2
    Last Post: 03-05-2003, 01:03 PM
  5. "Best Of" Archived Messages back online
    By Kevin Anderson in forum Alpha Five Version 4
    Replies: 0
    Last Post: 07-07-2000, 08:10 AM

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
  •