Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Un-hidden a field when a value in a drop down list is selected

Avatar

Level 2

Hi guys, so far this site has been very useful. Thank you

But I have a little problem that I'm not sure how to tackle, so I have a hidden field below a drop down list. My goal is to make the hidden field visible when a certain value in the drop down list is selected

Untitled.png

How do I go about doing that?

I've tried

if(form.legalstatus.rawValue == "1") (there's many choices)

{

     form.size.presence = "visible";

}

else

{

     form.size.presence = "hidden";

}

This doesn't work, and it also make the hidden field visible no matter what answer is selected.

Thanks in advance for any advice.

3 Replies

Avatar

Level 6

Make a change to the above script and place on "Change" event of "legalstatus".

if(xfa.event.newText == '1'){

form.size.presence = "visible";

}else{

form.size.presence = "hidden";

}

If the above script has issues, please check the hierarchy/path of the drop downs("form.size" / "form.legalstatus").

-Raghu.

Avatar

Level 2

That doesn't seem to work =( the hidden field was still hidden whatever the result of the drop down list was. My hierarchy looks ok, not sure what's wrong. Is there another function to do this?

Avatar

Level 2

Actually I've figured it out, if you place that code under "Exit" even instead of change it seem to work.