back button property

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
randyh
Profound User
Posts: 21
Joined: Mon Dec 15, 2014 5:21 pm
First Name: Randy
Last Name: Heinz
Company Name: Southwestern Motor Transport
Phone: 210.662.3272
Address 1: 4600 Goldfield
City: San Antonio
State / Province: Texas
Zip / Postal Code: 78218
Country: United States
Contact:

back button property

Post by randyh »

I using the back button property on a record format. What is the best business practice to close the ProFoundUI session and return to the calling web page without being prompted for the new session or close message. For example; I launch the ProFoundUI program from a web page (http://www.xxxx.com). As my ProFoundUI program executes and shows different pages, the back button works great and will bring me back to the first page of my ProFoundUI program after launching the program. When I press the back button, I end my RPG program successfully, but I'm prompted for a new session or close message. How do I bypass this message and return back to my web page http://www.xxxx.com. We have the genie application as well and I like to similate this same function that occurs with the signon screen.

Randy
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: back button property

Post by Scott Klement »

Maybe modify the "Your session has ended" screen to use pui.link() to go to whatever http://www.xxxx.com is?
randyh
Profound User
Posts: 21
Joined: Mon Dec 15, 2014 5:21 pm
First Name: Randy
Last Name: Heinz
Company Name: Southwestern Motor Transport
Phone: 210.662.3272
Address 1: 4600 Goldfield
City: San Antonio
State / Province: Texas
Zip / Postal Code: 78218
Country: United States
Contact:

Re: back button property

Post by randyh »

Scott

How do I capture the url that I came from when I first launch the ProFoundUI program?
randyh
Profound User
Posts: 21
Joined: Mon Dec 15, 2014 5:21 pm
First Name: Randy
Last Name: Heinz
Company Name: Southwestern Motor Transport
Phone: 210.662.3272
Address 1: 4600 Goldfield
City: San Antonio
State / Province: Texas
Zip / Postal Code: 78218
Country: United States
Contact:

Re: back button property

Post by randyh »

Scott

How do I capture the url that I came from when I first launch the ProFoundUI program?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: back button property

Post by Scott Klement »

I haven't tried this, so this is only a guess... but, try something like this when the "Your session has ended" page appears:

Code: Select all

pui.skipConfirm = true;
window.history.go(-2);
This should tell the browser to go back to the page before the page that loaded the Profound UI application.
randyh
Profound User
Posts: 21
Joined: Mon Dec 15, 2014 5:21 pm
First Name: Randy
Last Name: Heinz
Company Name: Southwestern Motor Transport
Phone: 210.662.3272
Address 1: 4600 Goldfield
City: San Antonio
State / Province: Texas
Zip / Postal Code: 78218
Country: United States
Contact:

Re: back button property

Post by randyh »

Scott

On the screen properties of my record format, how do I know when the back button has been pressed.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: back button property

Post by Scott Klement »

The back button property is bound to a DDS variable, an indicator. Your RPG program can check that indicator to determine if it was pressed.
randyh
Profound User
Posts: 21
Joined: Mon Dec 15, 2014 5:21 pm
First Name: Randy
Last Name: Heinz
Company Name: Southwestern Motor Transport
Phone: 210.662.3272
Address 1: 4600 Goldfield
City: San Antonio
State / Province: Texas
Zip / Postal Code: 78218
Country: United States
Contact:

Re: back button property

Post by randyh »

Scott

I can see the bound variable in the ProFoundUI program and will end the program properly when pressed.

What I'm don't understand is within the display file, how to determine when the back button was pressed within the onload event.

(this is what I've attempted to code)

if ("btnBack" !== null) {
pui.confirmOnClose = false;
} else {
pui.skipConfirm = true;
pui.closeSession();
window.history.go(-2);
}

I was thinking I could use the get(id) to get the value of the back button (left hand corner) of the page but I do not know what the id value is called because its only bound to a program field for the program to use. It not like an element defined on the page.

I've learned that the pui.closeOnClose = false; will allow a user to close a tab on the browser (executing my ProFoundUI program) without prompting the user "Your session has ended" with the 2 buttons "New session" or "Close" (so I've been coding that on all record format within the display file, because I never know when or where a user my want to exit my application by closing the browser tab). I only see the message ("Your session has ended") coming up when I exit the ProFoundUI program and my session needs be ended on the AS400 meaning its being the first called program in the job stack.

So now I see 3 conditions I'd like to code for in the onload event.

1) if the tab browser tab is closed; to execute pui.confirmOnClose = false; so the user is not prompted "Your session has ended."
2) if the back button is pressed and this ProFoundUI program was called by another ProFoundUI program just exit back to calling ProFoundUI program
3) if the back button is pressed and this ProFoundUI program was the first in the job stack, then execute the pui.skipConfirm = true; pui.closeSession(); window history.go(2);
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: back button property

Post by Scott Klement »

Your code is not correct, but I see the dilemmna.

Your code checks whether a character string containing the word "btnBack" is null, which makes no sense. If it's a string containing "btnBack" then it contains "btnBack" and therefore is not null :-) You probably meant to check a variable rather than a character string -- but that also won't work since there is no such variable.

When you use the "back button" feature, Profound UI sets a DDS variable (emphasis on DDS, NOT JavaScript) named btnBack which is sent to your RPG program. Your RPG program can choose to act based on it -- but this does not set anything in the JavaScript code on the page. You can't check for it that way.

My earlier suggestion was based on the idea that you'd want to do this any time the "end session" screen came up. It sounds like you don't -- you want to do it only when the back button was pressed on the previous screen, and not when the session is ended other ways. I'm not sure how to do that (at least, not without modifying Profound UI itself.) This is something I don't think anyone has tried to do before.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests