Highlighted

change textbox color with checkbox

New Here ,
Aug 24, 2020

Copy link to clipboard

Copied

Hello,

 

is it possible to change a textfield color when a checkbox is clicked in an finished pdf form?

like this:

Checkbox_1.PNGCheckbox_2.PNG

thanks!

 

Kind regards,

Heimo

Adobe Community Professional
Correct answer by John Mensinger | Adobe Community Professional

There are probably several ways to go about it in InDesign using the Show/Hide features and/or Multi-State Objects (MSO's). But the most relaiable way I've found to do things like this is assigning Javascript in Acrobat. At first it sounds complicated, but it's really not. If you'd like to try, here's a quick-and-dirty jumpstart:

 

1. In InDesign, add a separate rectangle to the page, assign the desired fill color, convert it to a Button named colorFill, and move it "behind" the text field. (Optionally, you could add this field in Acrobat, post-export.)

2. Export to Interactive PDF and open in Acrobat. Enter Acrobat's Form Edit mode.

3. Add a Text Field and open its properties.

4. Name the field anything you want, and set it to Hidden and Read Only:

Capture1.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5. On the Calculate tab, choose Custom Calculation Script and click Edit. Paste the following script commands (assumes your checkbox is named 'checkBox01'; substitute the actual name of yours):

 

var check = this.getField("checkBox01").value;

if (check == "Off")
{
this.getField("colorFill").display = display.hidden;
}

if (check == "Yes")
{
this.getField("colorFill").display = display.visible;
}

 

6. Click OK and Close. Click the Preview button on the Forms toolbar and test the behavior.

 

TOPICS
Scripting

Views

54

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

change textbox color with checkbox

New Here ,
Aug 24, 2020

Copy link to clipboard

Copied

Hello,

 

is it possible to change a textfield color when a checkbox is clicked in an finished pdf form?

like this:

Checkbox_1.PNGCheckbox_2.PNG

thanks!

 

Kind regards,

Heimo

Adobe Community Professional
Correct answer by John Mensinger | Adobe Community Professional

There are probably several ways to go about it in InDesign using the Show/Hide features and/or Multi-State Objects (MSO's). But the most relaiable way I've found to do things like this is assigning Javascript in Acrobat. At first it sounds complicated, but it's really not. If you'd like to try, here's a quick-and-dirty jumpstart:

 

1. In InDesign, add a separate rectangle to the page, assign the desired fill color, convert it to a Button named colorFill, and move it "behind" the text field. (Optionally, you could add this field in Acrobat, post-export.)

2. Export to Interactive PDF and open in Acrobat. Enter Acrobat's Form Edit mode.

3. Add a Text Field and open its properties.

4. Name the field anything you want, and set it to Hidden and Read Only:

Capture1.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5. On the Calculate tab, choose Custom Calculation Script and click Edit. Paste the following script commands (assumes your checkbox is named 'checkBox01'; substitute the actual name of yours):

 

var check = this.getField("checkBox01").value;

if (check == "Off")
{
this.getField("colorFill").display = display.hidden;
}

if (check == "Yes")
{
this.getField("colorFill").display = display.visible;
}

 

6. Click OK and Close. Click the Preview button on the Forms toolbar and test the behavior.

 

TOPICS
Scripting

Views

55

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 24, 2020 0
Advocate ,
Aug 25, 2020

Copy link to clipboard

Copied

Would creating a button and exporting as Interactive PDF do the trick for you?

 

Make 1 button for the X box and another BUtton over the text box. In the button options for the X tell it to Show/Hide button (select the button you created with the color), On the COLOR button tell it to hide until triggered. Below shows the options. in the Visibility the one with the eye will show the button if it has a X like the second picture it wont display and in the bottom picture is the color button tell it to display when triggeredScreen Shot 2020-08-25 at 8.19.30 AM.pngScreen Shot 2020-08-25 at 8.19.39 AM.pngScreen Shot 2020-08-25 at 8.19.48 AM.png

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 25, 2020 0
Advocate ,
Aug 25, 2020

Copy link to clipboard

Copied

Screen Shot 2020-08-25 at 8.15.23 AM.pngScreen Shot 2020-08-25 at 8.15.26 AM.png

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 25, 2020 0
Adobe Community Professional ,
Aug 25, 2020

Copy link to clipboard

Copied

There are probably several ways to go about it in InDesign using the Show/Hide features and/or Multi-State Objects (MSO's). But the most relaiable way I've found to do things like this is assigning Javascript in Acrobat. At first it sounds complicated, but it's really not. If you'd like to try, here's a quick-and-dirty jumpstart:

 

1. In InDesign, add a separate rectangle to the page, assign the desired fill color, convert it to a Button named colorFill, and move it "behind" the text field. (Optionally, you could add this field in Acrobat, post-export.)

2. Export to Interactive PDF and open in Acrobat. Enter Acrobat's Form Edit mode.

3. Add a Text Field and open its properties.

4. Name the field anything you want, and set it to Hidden and Read Only:

Capture1.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5. On the Calculate tab, choose Custom Calculation Script and click Edit. Paste the following script commands (assumes your checkbox is named 'checkBox01'; substitute the actual name of yours):

 

var check = this.getField("checkBox01").value;

if (check == "Off")
{
this.getField("colorFill").display = display.hidden;
}

if (check == "Yes")
{
this.getField("colorFill").display = display.visible;
}

 

6. Click OK and Close. Click the Preview button on the Forms toolbar and test the behavior.

 

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 25, 2020 1