- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2015 09:20 AM
I have a UI Action (form button) which I want to modify.
If you click on it and the field "work_around" is empty I would like a popup that tell the user that "work_around" has to be entered.
If the field "work_around" has any value there should be no popup and the UI Action should be executed.
Any Idea how I could achieve this?
I've tried with the following
Client: True
Action name: post_kb
Onclick: cancelPost
function cancelPost(){
if (current.work_around == ''){
alert('MY ALERT MESSAGE.');
return false;
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'post_kb'); //MUST call the 'Action name' set in this UI Action
}
Rest of the code for the UI Action goes here....
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2015 09:28 AM
Hi Fredrik,
You are using current in client side code that is why it is not working.
Use Below code:
- function cancelPost(){
- if (g_form.getValue('work_around') == ' '){
- g_form.showFieldMsg('work_around','MY ALERT MESSAGE');
- return false;
- }
- //Call the UI Action and skip the 'onclick' function
- gsftSubmit(null, g_form.getFormElement(), 'post_kb'); //MUST call the 'Action name' set in this UI Action
- }
- Rest of the code for the UI Action goes here....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2015 09:28 AM
Hi Fredrik,
You are using current in client side code that is why it is not working.
Use Below code:
- function cancelPost(){
- if (g_form.getValue('work_around') == ' '){
- g_form.showFieldMsg('work_around','MY ALERT MESSAGE');
- return false;
- }
- //Call the UI Action and skip the 'onclick' function
- gsftSubmit(null, g_form.getFormElement(), 'post_kb'); //MUST call the 'Action name' set in this UI Action
- }
- Rest of the code for the UI Action goes here....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2015 09:45 AM
Thanks!
I still use alert instead of g_form.showFieldMsg, otherwise I won't get the popup and most people seem to not notify the Field Msg.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2015 09:35 AM
Look at the OOB UI Action 'Resolve Incident', it does pretty much what you are trying to accomplish here.
My guess is that you code should look something like this:
...
Onclick: cancelPost();
function cancelPost(){
if(g_form.getValue('work_around') == ''){
alert("Your alert message");
return false;
}
//Call the UI Action.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2015 09:51 AM
When looking at our OOB UI Action "Resolve Incident" it has nothing on this in it, maybe because we started on Aspen release?
Only code in the UI Action is
current.state = 6;
current.update();