Condition based on multiple choise option

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

12 Jul 2018

Hi
I am trying to set up the condition which will show/hide some accordion tabs based on what check boxes are checked in multiple choice field. here is my code for one:

Code: Select all

function setIFS() {
	var checkboxIndex = 1;
    fd.field('FinanceSys').control()._el().find('input[type="checkbox"]').eq(checkboxIndex).is(':checked');
  if (checkboxIndex != null) {
 
$('#fd_accordion-0 > h3').eq(0).show();
$('#fd_accordion-0 > div').eq(0).show();
  } else {
$('#fd_accordion-0 > h3').eq(0).hide();
$('#fd_accordion-0 > div').eq(0).hide();
  }
}
 
fd.field('FinanceSys').change(setIFS);
 
setIFS();
The idea is if 1st check box is chosen then IFS accordion tab will be shown. But it is not working.... Please help me with setting this condition.

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

12 Jul 2018

Dear Katy,
Why not use our JavaScript API to retrieve values from choice field with checkboxes?

A condition like this should do:

Code: Select all

if(fd.field('Checkboxes').value().indexOf(0) >= 0) {
  //first option selected
}
else {
  //first option not selected
}
Cheers

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

13 Jul 2018

That works! Thank you, Nikita!

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests