Make field mandatory only by clicking a ui action button

Alessia Russo
Tera Expert

Hi everybody! I would like to make a field in my form mandatory only if a user of a group is trying to click a specific ui action button. How could I do it? With some script? Which one?

I've tried with policy and br, but it make the field mandatory for all the other ui buttons in the form in that particular state.

Thanxs

5 REPLIES 5

Deepak Negi
Mega Sage
Mega Sage

Hi

 

Without updating the action script, you can do this by a client script.

1. Check the Action Name field of the UI action for which you need to make the field mandatory.

2. Create an OnSubmit script and follow below:

var actionName  = g_form.getActionName(); //identifies the button name clicked

if(actionName == "YOUR_ACTION_NAME")
g_form.setMandatory('<field_name',true);

You can update the code including empty check and other required conditions.

 

Hope this helps!

 

Thanks
Deepak