Depends on - how to

I’m trying to make a field appear but on if another field has data in it. I tried myfield eval:doc.customer==yes and myfield eval:doc.customer but neither works. I don’t need specific data to appear in the customer field. If the customer field has any data I need the customer group field to appear.

How do I do this?


Hi sofia,

This formula goes to the field which is dependent

please change thename_ofthefield

Hi @ferohers,

Thanks but it did not work. Even when the customer field has info, the customer group field will not appear. I need the customer group field to appear with the customer field has data.

Hi sofia,

I am not a programmer at all. I am sure you will get support soon. There must be a code to trigger what you want.

Hi @sofia, @ferohers

You can use

eval:doc.customer && doc.customer.length

It will say "When “customer field have a value” and “the value have a length” because “” is a valid value, but without length


@max_morais_dmm, it worked! thank you very much!!

@max_morais_dmm, I’d like to add another option to these fields. Basically I’d like them to work like this:

I have 2 fields. One is for customer group and the other for customer. I’d like to always be able to input a customer group. Only if the customer field has data then the customer group field becomes mandatory. But the customer group field should be able to have data even if the customer field is blank.

Can I do this?


There is no dynamic mandatory, but I guess its a good feature to have.

You can use this to make things conditionally mandatory. Add it in your trigger and refresh.

cur_frm.set_df_property("fieldname", "reqd", true);

How can i use this conditionally mandatory script line to make a filed mandatory based on the choice made on a select field ?
Basically, I m using the eval.doc to have a field appear based on an initial Select field choice, but i don’t see how i can make this appearing conditionally mandatory when that choice is selected only.


@Manu Share what you have done so far

Well, to make it simple, i have created a link field “invoice no” with the following depend on : eval:doc.choice==“invoice”. But I need this field to be mandatory only if selected from my select field “choice”.

Depends on only works for show/hide, not mandatory.


what if i want a specific field to appear when two of four choices are selected? what do i put under eval:doc. then?

Hello guys,
I have the same question in this case.

What I need is that -->
when the" web user" is checked , the “entry password” will change the status and become to Mandatory
but if the “web user” is not being check , the “entry password” will not change anything

and I wrote a Custom Script like

cur_frm.cscript.custom_validate= function(doc){
    cur_frm.set_df_property("password", mandatory, doc.web_user=="1");

but it didn’t work , how can I do for it ?

BTW , the" web use" id is web_user
and the “entry password” id is password

@rmehta please help me~

@1119 please don’t tag users for help, this is a vountary forum

this script gets executed only when save button is hit.

1 Like

Thanks for your kindly reminder.
I will do better next time

@Johannes_Maepa In case you have note solved it yet, else may be helpful for anyone looking for a similar answer.

eval:doc.my_field=='Choice1' || doc.my_field=='Choice2'

1 Like