Fields not hidden upon return/change of answer on Java Window.

Aug 08, 2018

Copy link to clipboard

Copied

I have created a Javascript Window attached to a Radio button where upon selecting Yes, some text fields populate and upon selecting No, the fields are hidden. I realize that if yes was selected by mistake, the fields still remain visible when you return to the window and click no. What can I do to make the script work where you can return to change selection and it remove and hide the fields consistently?

Here this my script,

//Message for the popup window//

cMsg = "Do you want to deactivate the incumbent's previous position for this Job Change?\n"

var nRtn = app.alert(cMsg,2,2,"Deactivate Previous Position");

// field that populate upon selecting the option Yes//

if(nRtn == 4)

this.getField("LayerButton7").display = display.visible;

if(nRtn == 4)

this.getField("Text16").display = display.visible;

//Fields are hidden upon selecting No//

elseif(nRtn == 3)

this.getField("LayerButton7").display = display.hidden;

elseif(nRtn == 3)

this.getField("Text16").display = display.hidden;

Your code is incorrect, both in syntax and in logic.

You need to do it like this:

var cMsg = "Do you want to deactivate the incumbent's previous position for this Job Change?\n"

var nRtn = app.alert(cMsg,2,2,"Deactivate Previous Position");

if (nRtn == 4) {

    this.getField("LayerButton7").display = display.visible;

    this.getField("Text16").display = display.visible;

} else if (nRtn == 3) {

    this.getField("LayerButton7").display = display.hidden;

    this.getField("Text16").display = display.hidden;

}

TOPICS
Acrobat SDK and JavaScript

Views

78

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Fields not hidden upon return/change of answer on Java Window.

Aug 08, 2018

Copy link to clipboard

Copied

I have created a Javascript Window attached to a Radio button where upon selecting Yes, some text fields populate and upon selecting No, the fields are hidden. I realize that if yes was selected by mistake, the fields still remain visible when you return to the window and click no. What can I do to make the script work where you can return to change selection and it remove and hide the fields consistently?

Here this my script,

//Message for the popup window//

cMsg = "Do you want to deactivate the incumbent's previous position for this Job Change?\n"

var nRtn = app.alert(cMsg,2,2,"Deactivate Previous Position");

// field that populate upon selecting the option Yes//

if(nRtn == 4)

this.getField("LayerButton7").display = display.visible;

if(nRtn == 4)

this.getField("Text16").display = display.visible;

//Fields are hidden upon selecting No//

elseif(nRtn == 3)

this.getField("LayerButton7").display = display.hidden;

elseif(nRtn == 3)

this.getField("Text16").display = display.hidden;

Your code is incorrect, both in syntax and in logic.

You need to do it like this:

var cMsg = "Do you want to deactivate the incumbent's previous position for this Job Change?\n"

var nRtn = app.alert(cMsg,2,2,"Deactivate Previous Position");

if (nRtn == 4) {

    this.getField("LayerButton7").display = display.visible;

    this.getField("Text16").display = display.visible;

} else if (nRtn == 3) {

    this.getField("LayerButton7").display = display.hidden;

    this.getField("Text16").display = display.hidden;

}

TOPICS
Acrobat SDK and JavaScript

Views

79

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 08, 2018 0
Aug 08, 2018

Copy link to clipboard

Copied

Your code is incorrect, both in syntax and in logic.

You need to do it like this:

var cMsg = "Do you want to deactivate the incumbent's previous position for this Job Change?\n"

var nRtn = app.alert(cMsg,2,2,"Deactivate Previous Position");

if (nRtn == 4) {

    this.getField("LayerButton7").display = display.visible;

    this.getField("Text16").display = display.visible;

} else if (nRtn == 3) {

    this.getField("LayerButton7").display = display.hidden;

    this.getField("Text16").display = display.hidden;

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 08, 2018 0
Aug 08, 2018

Copy link to clipboard

Copied

Oh I see. The code I provided is working at it should except for the return. But this Worked Like Magic!!!!!

Thank you! I need to learn more about how to properly code.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 08, 2018 0
try67 LATEST
Aug 08, 2018

Copy link to clipboard

Copied

The code you submitted should throw an exception when you enter it, as "elseif" is invalid.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 08, 2018 0