Ajax refresh for screen action input parameters

Ajax refresh for screen action input parameters

  
My question is about  what types of memory to use with input parameters for screen actions.

I have just discovered that if some varible has been assigned a new value, any screen action (e.g. after a button is clicked) that needs that varible as an input parameter needs to be refreshed via ajax. Otherwise, the button will be passing the old value into the screen action.

Coming from a server-side background I tend to think  when you call a function at that point you send the function the varible's value. Of course on the client's webpage the value to be passed on the button click will not have been changed and it has to be refreshed. My bad. 

Right now it looks like if on the serverside there's a change to myCurVarible in a List used by one ListBox, I have to get Ajax to make a refresh for every button and combobox that makes use of myCurVarible.

Is this standard design? Is there a more efficient way?

Hello Mark,

Unfortunately I'm not able to understand your question very well.

Screen actions run on the server. When you click a button, for example, a request is made to the server and the logic of the screen action associated with the button runs there. Now comes the tricky part: if after running the logic on the server something must change on the page displayed by the browser, you must either:
  • Refresh the whole page (navigate to the same page); or
  • Refresh only the part of the page that must be updated (using AJAX).
You can read more about this or watch a video that explains how to refresh parts of a page with AJAX.


Hi Mark,

The destination of a button is set at render time, so if there's a variable's value in the URL, it will take the then-current value of the variable, and assign the URL to the destination. If the variable changes it's value afterwards, you'll indeed need an Ajax refresh. The alternative is to create a screen action that triggers when the button is clicked, and call a destination from there. In that case you won't have this problem.

As for ListBoxen and other screen widgets, they have their own copy of the assigned list. So if you modify the original list, you need to reassign that. I'm not sure whether I'd call that inefficient, but it's something to be aware of.
Okay I see now. Ajax is the efficient solution as it "allows for web pages, and by extension web applications, to change content dynamically without the need to reload the entire page"

Thank you for your replies.