HI Mike,
I use the code p_web.Script( p_web.WindowOpen( 'YourProcedure')) in several ways.
1. I have a button which selects a line from a browse to use as a reference during the session.
when the user presses this button and my code is done the last line of my code can be - p_web.Script( p_web.WindowOpen( 'IndexPage')) and it will go there. However, I prefer the second approach.
2. The same browse is called from two different procedures which are menus. To return to the menu which called this browse I pass a paramenter - 'IR=YES' or 'IR=YES_SM' .
in the browse, % BeforeFormTag/5000 embed:
if P_web.gsv('loc:IR') = 'YES' or P_web.gsv('loc:IR') = 'YES_SM'
p_web.SSV('SubHeading', 'Please Select Auto Dealership for this Service!')
! loc:selecting = true
end
IF P_web.gsv('loc:IR') = 'YES_SM'
loc:CloseAction = 'A_MOBILEBUTTON_MEMFORM' ! call small menu
else
loc:CloseAction = 'INDEXPAGE' ! go back to index page for large menu
END
This is where the action is set to perform when the Close Button is pressed. So, when the user picks a record. I pop up a message that identifies the chosen record and then prompts them to press the CLOSE button. I prefer code 2 so that I make sure that each procedure I open is closed correctly.
[Behind the scenes. How did I get there... I put the procedure name to run in the Template when the close button is pressed. I then looked at the code and the Close button uses loc:CloseAction as a reference to the procedure to run when CLOSE is pressed. I then looked at where the template assigned the value to the loc:CloseAction. It is way up in the code before calling the form tag. So, right after the Template assigned it, I popped in my code to overwrite that assignment to the one I wanted to be run - hence, the code above....]
Ron