Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Make the field mandatory based on value of the another field

Madhura A S
Contributor
October 30, 2018

Hi ,

I am trying to make a custom field mandatory based on the value of another custom field using SIL script.

if (argv["customfield_17000"] == "Digital ad" ){
lfShow("customfield_18600"); //Gifs or HTML5
lfShowFieldMessage("customfield_18600", "Field is required", "WARNING");
lfShow("customfield_18601"); //Maximum file size
lfShowFieldMessage("customfield_18601", "Field is required", "WARNING");
lfDisable("editSubmit");

But submit button is not getting disabled. Please help me to resolve this

1 answer

2 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 30, 2018

Hello,

It should be like this:

if (argv["customfield_17000"] == "Digital ad" ){
lfShow("customfield_18600"); //Gifs or HTML5
lfShowFieldMessage("customfield_18600", "Field is required", "WARNING");
lfShow("customfield_18601"); //Maximum file size
lfShowFieldMessage("customfield_18601", "Field is required", "WARNING");
lfDisable("editSubmit");
}

You forgot closing parenthis.

Also how did you connect this hook?

lfWatch("customfield_17000", {customfield_17000"}, "yoursilfile.sil");

What is the customfield_1700 type?

Madhura A S
Contributor
October 30, 2018 edited

Hi,

Sorry i missed to add the parenthesis here.  customfield_17000 is a single -select select list type. 

I added this script to main script and executed as Live field. 

Field messages are getting displayed but Submit button is not getting disabled. I referred this document

https://confluence.cprime.io/display/TR/Make+a+custom+field+required+based+on+another+custom+field

Regards,

Madhura

Suggest an answer

Log in or Sign up to answer