UI action return false

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2013 01:28 PM
Hi everyone.
How do I make a UI action do nothing? By nothing, I mean don't even reload the page?
I have a button that shows up but I need it to only be clickable if a particular field is filled in. I don't want to make this a condition of the button because the button wouldn't be there unless the field was populated properly before the page loaded.. this would just mean they'd need to save the form after updating the field before the button would show up.
Instead, I want to just do something like
if (current.field == "empty") { return false; }
But that doesn't seem to be doing anything at all. It stops the rest of the UI action from processing but it still reloads the main form.
Any help would be much appreciated.
- Labels:
-
Orchestration (ITOM)
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2013 01:41 PM
What if you do the opposite:
if(current.field !=''){
do your thing;
}
Or if you haven't 'saved' the record yet, you will need to run 'client-side' and use:
if (g_form.getValue('field') != '').....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2013 05:42 AM
Hi Terri,
Unfortunately that makes the screen refresh. I created the simplest of scripts in the sandbox
testThis();
function testThis(){
}
And although nothing is happening in the code, it redirects you back to the list view of the table you are in.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2013 05:56 PM
I guess writing an onsubmit client script and then returning 'false' (based on the conditions) could be a solution for your problem.
That would stop the form from being submitted.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2013 05:43 AM
Thank you for this. I thought of this but I told myself "nah, that can't be right. why would a client script have any impact on a UI action?" But I gave it a whirl and returning false in an onsubmit script absolutely did what I needed.
Thank you!