Condition on radio-button choice field

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

11 May 2017

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?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

12 May 2017

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()) { ... }

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

12 May 2017

value() == -1 is sneaky :-)) I'll try it today. Thank you !

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests