Condition on radio-button choice field
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?
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?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Katy,
Here is the code that checks if a radio-choice is empty in new and edit forms:
And this is for display forms:
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) { ... }
Code: Select all
if (!fd.field('Radio').value().trim()) { ... }
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests