Page 1 of 1

Condition on radio-button choice field

Posted: 11 May 2017
by Katy
Hi, i am trying to set up a condition for the following scenario:
There is a choice field with radio buttons option, set up clear by default, if the user does not choose any of the options certain field become available and mandatory. If the user chooses anything - fields become hidden. I am struggling with setting that initial if for the field, i tried:
if (fd.field('fieldname').value(null)
if (fd.field('fieldname').value()
if (fd.field('fieldname').value()==null

I kinda made a workaround for showing/hiding using: (fd.field('fieldname').value()==0 || fd.field('fieldname').value()==1) - but it doesn't work on Display form or for mandatory field condition (as it has nested structure and based on several fields).
Could you please help me to specify it?

Re: Condition on radio-button choice field

Posted: 12 May 2017
by Dmitry Kozlov
Hi Katy,

Here is the code that checks if a radio-choice is empty in new and edit forms:

Code: Select all

if (fd.field('Radio').value() == -1) { ... }
And this is for display forms:

Code: Select all

if (!fd.field('Radio').value().trim()) { ... }

Re: Condition on radio-button choice field

Posted: 12 May 2017
by Katy
value() == -1 is sneaky :-)) I'll try it today. Thank you !