Skip to main content
Participant
April 24, 2024
Question

Struggling with Coding

  • April 24, 2024
  • 2 replies
  • 436 views

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 has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
April 24, 2024
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Renee5FCEAuthor
Participant
April 24, 2024

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?

Renee5FCEAuthor
Participant
April 24, 2024

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;
}

Bernd Alheit
Community Expert
Community Expert
April 24, 2024

The ( and ) are not correct.