Field Rule IF ELSE statement

Field Rule IF ELSE statement

I am trying to make a New Hire form with a resource field (RES_7205_QUS_307).  It is a checklist of internal software.  I have created multiple separate resource questions that are replacing paper request forms for those applications.

I am trying to initially have the application-specific resource questions to be hidden until the user selects the application in the checklist.  Then have those specific resource questions appear.  If the user deselects the application, I want those questions to be hidden again.  The tricky part of this is that the user can have multiple applications selected, and I need multiple sets of fields to display.

Here is what I did:

I have the Form load rule, which hides all the relevant fields. 

On the field change event for the software list, I am executing a script

The script first gets the value of the software list.  In this case, it is "Service Matrix".  I then pass it through a if \ else statement, which checks for the Service Matrix value.  If it exists, then it performs a ShowField action for those particular resource fields.

At the end, to make sure I have the correct field value, I have it appear in the description field.

/*Get value of a field*/
var x=$CS.getValue("RES_7205_QUS_307");

if (x == 'Service Matrix') { $CS.ShowField(["RES_7206_QUS_6915","RES_7207_QUS_6917","RES_7207_QUS_6915"]);}

else

/*To set content of Description field use below method*/
$CS.setDescription(x);


I cannot get the fields to appear using this code.  What is the best way to use javascript to change groups of fields based on resource selections?

Sorry, I am new to coding, but really did try.

Thanks

Dave

                  New to ADSelfService Plus?