Skip to main content
Participant
Apr 24, 2024 3:42 PM UTC
Question

Struggling with Coding

I am new to coding and am struggling with continuing to get errors on this code. I have made a drop down box and if the person selects other I would like a text box to appear. I have been trying to find an answer online and no luck. 

 

if (event.value == "Other")
(
this.getField("Text3").display = display.visible);
)
else if (event.value == "Get_furniture")

this.getField("Text3").display = display.hidden;
)
else if (event.value == "Get_housing_assistance")
(
this.getField("Text3").display = display.hidden;)
)
else if (event.value == "Get_internet_access")
(
this.getField("Text3").display = display.hidden;)
)
else if (event.value == "Get_stable housing")
(
this.getField("Text3").display = display.hidden;)
)
else if (event.value == "Shelter")
)
this.getField("Text3").display = display.hidden;)
(

 

It is currently giving me Syntax Error 4 for line 5. 

 

Any help would be appreciated.

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Thom Parker
Community Expert
Community Expert
Apr 24, 2024 7:32 PM UTC
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Renee5FCEAuthor
Participant
Apr 24, 2024 10:53 PM UTC

Thank you for the help! We got the code to work but now we ran into another issue. When I select other the text box appears but then if I choose any of the other items in the drop down list the text box remains. Any solutions?

Translate
Renee5FCEAuthor
Participant
Apr 24, 2024 11:05 PM UTC

Here is the new code - 

if (event.value == "Get_furniture")
{
this.getField("Text3").display = display.hidden;
}
else if (event.value == "Get_housing_assistance")
{
this.getField("Text3").display = display.hidden;
}
else if (event.value == "Get_internet_access")
{
this.getField("Text3").display = display.hidden;
}
else if (event.value == "Get_stable_housing")
{
this.getField("Text3").display = display.hidden;
}
else if (event.value == "Shelter")
{
this.getField("Text3").display = display.hidden;
}
else if (event.value == "Other")
{
this.getField("Text3").display = display.visible;
}

Translate
Bernd Alheit
Community Expert
Community Expert
Apr 24, 2024 4:59 PM UTC

The ( and ) are not correct.

Translate