- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2017 03:43 PM
Hi All,
I have a UI Action that redirects/refreshes itself like so,
action.setRedirectURL(current);
I however wish to have an alert to the user g_form.addInfoMessage("here"); after the form has been refreshed. I can't do it before the redirect because the alert message just disappears once the page starts loading.
Is there anyway to alert the user and refresh the form?
Thanks for any help.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2017 04:31 PM
That is because you have that statement in the onClick function. onClick function runs on the client side, before the form is submitted. For the message to be displayed after the form reloads, you need to have that in the server function.
If all you are doing is redirecting, then there's no point in including Client functionality. Uncheck the Client checkbox and paste this code in the Script:
action.setRedirectURL(current);
gs.addInfoMessage('here');
But if you have some client code to be executed before the server code, then it should be something like this:
//Client-side 'onclick' function
function onClick(){
// client side code goes here
gsftSubmit(null, g_form.getFormElement(), 'unassign');
}
//Code that runs without 'onclick'
if(typeof window == 'undefined')
serverCode();
function serverCode(){
action.setRedirectURL(current);
gs.addInfoMessage('here');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2017 04:29 PM
Hi,
Can you post your entire script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2017 04:31 PM
That is because you have that statement in the onClick function. onClick function runs on the client side, before the form is submitted. For the message to be displayed after the form reloads, you need to have that in the server function.
If all you are doing is redirecting, then there's no point in including Client functionality. Uncheck the Client checkbox and paste this code in the Script:
action.setRedirectURL(current);
gs.addInfoMessage('here');
But if you have some client code to be executed before the server code, then it should be something like this:
//Client-side 'onclick' function
function onClick(){
// client side code goes here
gsftSubmit(null, g_form.getFormElement(), 'unassign');
}
//Code that runs without 'onclick'
if(typeof window == 'undefined')
serverCode();
function serverCode(){
action.setRedirectURL(current);
gs.addInfoMessage('here');
}