- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 01:00 PM - edited ‎06-26-2023 12:07 PM
Hello Everyone,
New developer here. I have a requirement to add an alert message when a choice field selection is made and make work notes mandatory on the UI page. The field is Validation Type (valtype on the UI page / 'validation_type' on the Form) when the user selects the option: "Accepting Risk/Not Testing" an alert popup message should appear and the work notes field should become mandatory.
I've written a script in the client script section of the UI page but it is not working. Can anyone please assist me with this?
Edited to remove code
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 03:50 PM
I took what you put together and started looking through what is actually rendered. There is an onchange event already attached to the <select> tag that is rendered on the page simply called onChange. It passes in the name of the ui_choice_input_field so it's easy to determine which input field changed in the function if you have more than one of them.
Using that, I changed the Client Script to the following which worked for the alert part:
function onChange(ui_choice_input_field_name){
if(jQuery("#" + ui_choice_input_field_name + " option:selected").val() == "not_testing"){
alert('By selecting Accepting Risk/Not Testing, you will be responsible for any issues with functionality experienced by your CI/Application post release activity. Please update the work notes with the reason you are accepting risk/not testing.');
field.column_name = "work_notes_update";
field.mandatory = true;
}
}
I'm not sure about setting the field you want to Mandatory though since I don't know how the UI Page is accessed/rendered and there isn't a work_notes_update field on the UI Page with what you provided. I hope this gets you started at least.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2022 03:50 PM
I took what you put together and started looking through what is actually rendered. There is an onchange event already attached to the <select> tag that is rendered on the page simply called onChange. It passes in the name of the ui_choice_input_field so it's easy to determine which input field changed in the function if you have more than one of them.
Using that, I changed the Client Script to the following which worked for the alert part:
function onChange(ui_choice_input_field_name){
if(jQuery("#" + ui_choice_input_field_name + " option:selected").val() == "not_testing"){
alert('By selecting Accepting Risk/Not Testing, you will be responsible for any issues with functionality experienced by your CI/Application post release activity. Please update the work notes with the reason you are accepting risk/not testing.');
field.column_name = "work_notes_update";
field.mandatory = true;
}
}
I'm not sure about setting the field you want to Mandatory though since I don't know how the UI Page is accessed/rendered and there isn't a work_notes_update field on the UI Page with what you provided. I hope this gets you started at least.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2022 07:29 AM
Thank you so much for your help with this script Claude!!! It worked exactly as I needed it to (and I learned what my mistakes were in the process) - thank you so much!!!