Make field mandatory depending on something else
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2016 08:40 AM
I know I can use UI Policies to make a field mandatory based on certain conditions however i need to make a field mandatory the next time a form is opened and can't make it work.
Scenario is I am building a bespoke change application for a part of our business and once the change manager assigns the change to an individual I want the development field (u_development) to become mandatory only once the form is saved. I don't want the change manager to have to update the u_development field which is what a UI Policy enforces.
Can I achieve this?
Many thanks
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2016 08:45 AM
Hi Angus,
You can make an onLoad client script in which you can test if the conditions you want to make the field mandatory are matching or not.
Kind regards
ZA
Do not feel shy to mark correct or helpful answer if it helps or is correct
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2016 08:58 AM
Here is a script I've just made to make the worknote mandatory, You can use it for another field :
function onLoad() {
//Type appropriate comment here, and begin script below
var new_val = g_form.getValue("assigned_to");
if (new_val != '') {
try {
g_form.hideFieldMsg('work_notes');
} catch(e) {
}
g_form.setMandatory('work_notes', true);
g_form.showFieldMsg('work_notes','Please add details','error');
g_form.flash("work_notes", "#FFFACD", 0);
return false; //Abort submission
}
}
Kind regards,
ZA
Do not feel shy to mark correct or helpful answer if it helps or is correct
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2016 12:24 AM
Many thanks for replying however that script appears to do little more than a UI policy unfortunately. Despite it being an onLoad script when I make the changes to the form and attempt to save it I'm told the development field is mandatory?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2016 12:43 AM
FWIW my script is below:-
function onLoad() {
//Type appropriate comment here, and begin script below
var new_val = g_form.getValue("u_assigned_to");
if (new_val != '') {
try {
g_form.hideFieldMsg('u_development');
} catch(e) {
}
g_form.setMandatory('u_development', true);
g_form.showFieldMsg('u_development','Please add details','error');
g_form.flash("u_development", "#FFFACD", 0);
return false; //Abort submission
}
}