Type into a field that is set to auto-generate from a checkbox?

New Here ,
May 11, 2020

Copy link to clipboard

Copied

Hello,

 

Is it possible to type into a field that is set to autogenerate information from a selected checkbox?

 

Example:

I have four checkboxes on page one of myy PDF that generate predermined phrases into a field located on page two. I'd like to add an additional field called 'Other'. I want the user to be able to type unrestricted information into the Other field and have the information generated in to the field on page two.

 

Below is the code I've applied to the field on page two. Is there anything I can add to get the desired results?

 

var a=""

 

if (this.getField("CB1").value == "Yes")
{
a="\u2610 Option One \n"
}

if (this.getField("CB2").value == "Yes")
{
a=a + "\u2610 Option Two \n"
}

if (this.getField("CB3").value == "Yes")
{
a=a + "\u2610 Option Three \n"
}

if (this.getField("CB4").value == "Yes")
{
a=a + "\u2610 Option Four \n"
}

event.value=a

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

139

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

Type into a field that is set to auto-generate from a checkbox?

New Here ,
May 11, 2020

Copy link to clipboard

Copied

Hello,

 

Is it possible to type into a field that is set to autogenerate information from a selected checkbox?

 

Example:

I have four checkboxes on page one of myy PDF that generate predermined phrases into a field located on page two. I'd like to add an additional field called 'Other'. I want the user to be able to type unrestricted information into the Other field and have the information generated in to the field on page two.

 

Below is the code I've applied to the field on page two. Is there anything I can add to get the desired results?

 

var a=""

 

if (this.getField("CB1").value == "Yes")
{
a="\u2610 Option One \n"
}

if (this.getField("CB2").value == "Yes")
{
a=a + "\u2610 Option Two \n"
}

if (this.getField("CB3").value == "Yes")
{
a=a + "\u2610 Option Three \n"
}

if (this.getField("CB4").value == "Yes")
{
a=a + "\u2610 Option Four \n"
}

event.value=a

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

140

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
May 11, 2020 0
try67 LATEST
Most Valuable Participant ,
May 12, 2020

Copy link to clipboard

Copied

Change your code to the following:

 

if (event.source && //^CB\d$/.test(event.source.name)) {
// rest of code goes here
}

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...
May 12, 2020 0