Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Help with multiple selections needed

Avatar

Former Community Member

Hi All,

I used this forum where I was given an answer to my question (Thanks Paul). My question now is:

I have a drop list with script behind it that makes a text field visible:

if (xfa.event.newText=="Vacancy")
form1.SBF00.position1.presence= "visible";
else form1.SBF00.position1.presence= "hidden";

The issue I have now is that more than one entry in the drop list required the text field to become visible. I did try this:

(First line on form)

if (xfa.event.newText=="Vacancy")or

(xfa.event.newText=="Sickness")or

(xfa.event.newText=="Annual Leave")
form1.SBF00.position1.presence= "visible";
else form1.SBF00.position1.presence= "hidden";

(Second line on form)

if (xfa.event.newText=="Vacancy")or

(xfa.event.newText=="Sickness")or

(xfa.event.newText=="Annual Leave")
form1.SBF00.position2.presence= "visible";
else form1.SBF00.position2.presence= "hidden";

I  have the form set up with multiple lines that the end user can move  down should they need more than one entry.It sort of works but if I  select Sickness for example, the next box down (position2) doesn't show  the text box visible if I choose, for instance, 'Vacancy'.

Thanks everyone.

Heavy E

1 Accepted Solution

Avatar

Correct answer by
Level 6

Try this:

if ((xfa.event.newText == "Annual Leave")||(xfa.event.newText == "Sickness")){
xfa.form.form1.BodyPage1.position1.presence = "visible";}
else {xfa.form.form1.BodyPage1.position1.presence = "hidden";}

View solution in original post

6 Replies

Avatar

Level 6

You will need to duplicate the code for each droplist item and for each droplist:

if (xfa.event.newText=="Vacancy")
form1.SBF00.position1.presence= "visible";
else form1.SBF00.position1.presence= "hidden";

if (xfa.event.newText=="Sickness")
form1.SBF00.position1.presence= "visible";
else form1.SBF00.position1.presence= "hidden";

if (xfa.event.newText=="Annual Leave")
form1.SBF00.position1.presence= "visible";
else form1.SBF00.position1.presence= "hidden";

Complete on droplist and then copy it.

second droplist would look like this:

if (xfa.event.newText=="Vacancy")
form1.SBF00.position2.presence= "visible";
else form1.SBF00.position2.presence= "hidden";

Avatar

Former Community Member

Thanks Paul

I did try this but must have missed something, I'll copy the code when I get to work, and thanks.

Kind regards

Ed

Avatar

Level 6

I missed some brackets:

if (xfa.event.newText=="Vacancy")
{form1.SBF00.position2.presence= "visible";}
else {form1.SBF00.position2.presence= "hidden";}

Avatar

Former Community Member

Thank for the help, unfortunately I still cannot get the drop list to work properly so I am going to look for another way of doing it.

Avatar

Correct answer by
Level 6

Try this:

if ((xfa.event.newText == "Annual Leave")||(xfa.event.newText == "Sickness")){
xfa.form.form1.BodyPage1.position1.presence = "visible";}
else {xfa.form.form1.BodyPage1.position1.presence = "hidden";}

Avatar

Former Community Member

Paulk07 is the man! Thanks for the support.