Is it possible to create an "Are you sure" pop-up box with server-side scripts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 05:08 PM
Greetings, people.
I'm trying to configure an "Are you sure you want to cancel" dialog box, but I've been experiencing quite a bit of difficulties because of other business requirements:
- This "Are you sure you want to cancel" dialog box should appear right after I click on the "Cancel" button, and there should be a "I'm sure" button and a "Never mind" button.
- The business analyst dictated that I have to create a glideDialogWindow window, because the bare-bone JavaScript dialog box looks "unprofessional".
- Because one of the business requirement states that "Nobody should be able to modify the 'State' field manually. It has to be done through UI actions", and because I've created an ACL to address this requirement, I absolutely have to use server-side scripts in this UI action (Otherwise, the "State" field won't be updated at all, even when it needs to be updated). However, I haven't been able to find any examples of triggering a dialog box through server-side scripts.
Would anyone like to suggest what approach I should take?
Thank you in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 11:49 AM - edited 03-15-2023 11:49 AM
This is the simplest, but not necessarily the prettiest way. Not a hack, just not pretty with the standard Javascript confirm popup dialog.
1. Set your UI Action to run client-side by checking the "Client" field
2. Set the "Onclick" field to be "uFunctionNameClient();"
3. add this template to the "Script" field:
//client function that runs "onclick"
function uFunctionNameClient() {
if(confirm("Are you sure you want to ***?")) {
gsftSubmit(null, g_form.getFormElement(), "***u_action_name_goes_here***"); //MUST call the "Action name" for this UI Action
}
}
//code that runs on server once confirmed
//ensure call to server-side function with no browser errors
(function() {
if (typeof window == "undefined") {
//server-side code goes here
}
})();
The "uFunctionNameClient" function name must be the same in the "Onclick" and "Script" fields. Also, the "***u_action_name_goes_here***" in the "Script" field must match the value in the "Action name" field on the UI Action record.
There are ways of making the confirm popup prettier, one of them being "Simple Modal Confirm" UI Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 12:44 PM
Hello.
When I clicked on your "Simple Modal Confirm" link, I got the "Post not found: The post you are trying to access is not available." message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 09:37 PM
That's weird, I see they are marked as "spam". I can see them as the author, but I just tried without logging in and sure enough I cannot see them. I've contacted the Community to try to figure out what's up with them. I had actually edited them last night to fix some link issues that appeared during the migration to this new Community site.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 07:43 AM
That post is now visible again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 11:57 AM
Hello.
I hate to bear any more bad news, but I keep getting this error message:
My colleague tried the same approach in their own personal instance, and they got the same error message.
Would you happen to have any idea about what might be causing this?