passing values from a form to ui page through a ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2013 12:12 AM
Hi all
I am trying to redirect from a form to a ui page through a ui action.
the UI page contains the same fields as the form.
I want to display the values from the corresponding form on the ui page fields.
How can i pass the values from the form to ui page on pressing UI action button and display it on the corresponding fields of ui page?
Thanx in advance
Regards
Himanshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2013 10:17 AM
You can use a client side UI Action to pass variables to a UI Page.
Here is a sample script for the UI action. The UI Action's Onclick field would contain "do_call_ui_page()"
function do_call_ui_page(){
var comment_block = g_form.getValue('variable_1');
var v1 = g_form.getValue('variable_1');
var v2 = g_form.getValue('variable_2');
var gDialog = new GlideDialogWindow("Your UI Page");
gDialog.setTitle('Your UI Page Title');
gDialog.setPreference('table','this_table');
gDialog.setPreference('v1',v1 + '' || ''); // convert to string and OR with empty string
gDialog.setPreference('v2',v2 + '' || '');
gDialog.render();
}
Then you can retrieve the variables on the UI Page:
<g:evaluate var="jvar_v1" expression="RP.getWindowProperties().get('v1')" />
<g:evaluate var="jvar_v2" expression="RP.getWindowProperties().get('v2')" />
These variables can then be referenced somewhere in the html of your UI page:
<span id="var1">${jvar_v1}</span>
. . .
<span id="var2">${jvar_v2}</span>
I hope this helps!
Cheers,
Geoff.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2023 01:10 PM
Hello Geoff,
Do you know how I can access the form data in the client script section of the UI Page? Also how can I then fill data on the form from the UI Page?
Thanks,
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2023 10:37 PM
Did you got solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2013 10:53 AM
Thanx man, your code is working perfectly. . 🙂