Expand my Community achievements bar.

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

Drop Down List Selection Changes Display

Avatar

Former Community Member
I am designing a form that will change the display based on a selection made in a drop down list. A co-worker was able to do do this with radio buttons using Javascript and the .presence attribute. I inserted the following script:

if (Acttype.rawValue == 1)

{

Line1[1].presence = "visible";

RFRdenialofstep.presence = "visible";

RFRSuspend.presence = "invisible";

RFHTerm.presence = "invisible";

RFReview.presence = "visible";

RFHearing.presence = "invisible";

RFREmplysig.presence = "visible";

RFHEmplysig.presence = "invisible";

AAapproved.presence = "visible";

AAcancelled.presence = "visible";

CUEsigAA.presence = "visible";

TermHeartext.presence = "invisible";

RFHgranted.presence = "invisible";

Hearingdate.presence = "invisible";

RFHdenied.presence = "invisible";

CJhearingsig.presence = "invisible";

Line1[2].presence = "invisible";

DecisionText.presence = "invisible";

Termapproved.presence = "invisible";

Termcancelled.presence = "invisible";

CJdecsig.presence = "invisible";

}

else if (Acttype.rawValue == 2)

{

Line1[1].presence = "visible";

RFRdenialofstep.presence = "invisible";

RFRSuspend.presence = "visible";

RFHTerm.presence = "invisible";

RFReview.presence = "visible";

RFHearing.presence = "invisible";

RFREmplysig.presence = "visible";

RFHEmplysig.presence = "invisible";

AAapproved.presence = "visible";

AAcancelled.presence = "visible";

CUEsigAA.presence = "visible";

TermHeartext.presence = "invisible";

RFHgranted.presence = "invisible";

Hearingdate.presence = "invisible";

RFHdenied.presence = "invisible";

CJhearingsig.presence = "invisible";

Line1[2].presence = "invisible";

DecisionText.presence = "invisible";

Termapproved.presence = "invisible";

Termcancelled.presence = "invisible";

CJdecsig.presence = "invisible";

}

else if (Acttype.rawValue == 3)

{

Line1[1].presence = "visible";

RFRdenialofstep.presence = "invisible";

RFRSuspend.presence = "visible";

RFHTerm.presence = "invisible";

RFReview.presence = "visible";

RFHearing.presence = "invisible";

RFREmplysig.presence = "visible";

RFHEmplysig.presence = "invisible";

AAapproved.presence = "visible";

AAcancelled.presence = "visible";

CUEsigAA.presence = "visible";

TermHeartext.presence = "invisible";

RFHgranted.presence = "invisible";

Hearingdate.presence = "invisible";

RFHdenied.presence = "invisible";

CJhearingsig.presence = "invisible";

Line1[2].presence = "invisible";

DecisionText.presence = "invisible";

Termapproved.presence = "invisible";

Termcancelled.presence = "invisible";

CJdecsig.presence = "invisible";

}

else if (Acttype.rawValue == 4)

{

Line1[1].presence = "visible";

RFRdenialofstep.presence = "invisible";

RFRSuspend.presence = "invisible";

RFHTerm.presence = "visible";

RFReview.presence = "invisible";

RFHearing.presence = "visible";

RFREmplysig.presence = "invisible";

RFHEmplysig.presence = "visible";

AAapproved.presence = "invisible";

AAcancelled.presence = "invisible";

CUEsigAA.presence = "invisible";

TermHeartext.presence = "visible";

RFHgranted.presence = "visible";

Hearingdate.presence = "visible";

RFHdenied.presence = "visible";

CJhearingsig.presence = "visible";

Line1[2].presence = "visible";

DecisionText.presence = "visible";

Termapproved.presence = "visible";

Termcancelled.presence = "visible";

CJdecsig.presence = "visible";

}

When I preview the form, it does not run the script and I can't figure out why. I have compared my form with my co-worker's and I can't find a difference, except for the "else if" statements. But even when I take these out and just try to run a simple change, it doesn't work. Is there something I need to do additionally? I've set the language to Javascript.



Any help would be appreciated.



Thanks.
1 Reply

Avatar

Former Community Member
Hi lydia,



I think so the value u r selecting in the drop down is not recognized properly by the script code, to get the value of the drop down in onchange event try the following code,



xfa.event.newText;

in javascript, this returns the value selected by the user and use this value in ur script to compare.



Regards,

Sangeetha