How to prevent user from selecting 'None' for a mandatory field on a change request form.

LK11
Mega Expert

Hi All,

 

I have a field 'Justification' which is a conditional mandatory field, and it's a drop down list from where a user can select a choice.  When the 'Justification' field is not mandatory, 'none' is the default choice and the user can submit the form. 

The issue is that when 'Justification' is mandatory, if the user just clicks on the drop down list and selects 'None', they're able to submit the form.  Is there a way to prevent this and force the user to select a choice from the drop down list before submitting?

 

Thank you

1 ACCEPTED SOLUTION

Hi,

Below is what I did:

1. Wrote a onChange client script:

find_real_file.png

2. Out Put Risk is not mandatory 

find_real_file.png

2. OnChange when value is 2 for Priority

find_real_file.png

 

Thanks

View solution in original post

22 REPLIES 22

Ian Mildon
Tera Guru

You don't mention how you are setting Justification to mandatory (Business Rule, Client Script, UI Policy). Probably the easier way to achieve what you are wanting is to add to the current method you are using (if BR or CS).

 

Here is a quick and simple script to add to a Business Rule

if (current.justification = 'none') {
  current.setAbortAction(true);
} else {
    current.setAbortAction(false);
}

It will prevent the record being submitted until the Justification field is any value other than 'none'. You could also drop-in a gs.addInfoMessage to inform them of what is needed.

Hi Ian,

 

I used UI policy to make the field conditional mandatory.

Thanks

m_osborne
Kilo Sage

Did you add "None" as a choice in the Drop-Down variable? If so, you should remove this (and clear the default value if you put "None" there as well) and instead, check the follow box:

find_real_file.png

 

This should not allow a user to submit the form if your variable is mandatory and "None" is in the field.

If I don't include 'None' as an option, one of the other choices is displayed as default.  I don't want any choices to be displayed as default.  When the field becomes mandatory, the user is forced to choose one option from the drop down list.  Any suggestions?

 

Thank you