1 person found this helpful
Give your button a static ID (in button attributes) and change your dynamic action to
Selection Type: jQuery Selector
jQuery Selector: #your-static-id
This way you don't have to change the template.
To solve your region problem, you could create another dynamic action with event Page Load. You could use it to hide your regions and then use the first dynamic action (on click) to show the regions.
I think using the on click dynamic action to change the value of P400_DISPLAY won't work since the condition of the hidden regions will only be rendered on page load. So changing the value of P400_DISPLAY will not show your regions until you hit refresh.
The root issue is that, although you change the value of your page item, it isn't visible to other areas of the page until it is in the session. So, any other action based on the value of your page item; the visibility of a control, a report based on the item's value, etc. will all be unaffected by changing the value of the page item until it has been changed in the session. Even after this the items are stored in the session, you must thereafter do something to cause the value to be reevaluated. To see the effect of this, observe that your page loads and evaluates the value of your page item, it sees that is "MAIN" and hides the regions. However, it doesn't reevaluate them after this.
What you've done above sounds correct for this but, there are a lot of decisions you could have made that might have caused things not to happen in the correct sequence.
Firstly, let's confirm that what I describe above is your problem. From the development environment, load the page, click the button to change the value and submit. Now, click the link labelled Session. Is it still set to MAIN? If so; this is your issue.
Let's start with the your After Header computation. Did you set it to *only* run if the current value of your page item is NULL??? If not, that's your problem.
Load Page -> Item set to 'Main' by Computation -> Click Button -> Item set to STORE -> Submit -> Load Page -> Item set to 'Main' by Computation
See the problem?
Assuming this isn't the issue, you created a Branch to the same page, right? What is your process point for the Branch? Is it *After* Validation, Computation etc? Because if not, you aren't changing the value before the submit happens.
I bet it is the first issue but, take a look at these.
Thanks Martina and Joe. Both answers were very helpful. I can use the dynamic action fix for a different issue I am running into but Joe nailed it for this problem. I was submitting the page in the wrong place and not picking up the change. Sometimes you can't see the forest because of the trees. Thanks again for the second set of eyes.