• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Change color of text field when checkbox is selected

New Here ,
Oct 08, 2019 Oct 08, 2019

Copy link to clipboard

Copied

I'm created a form where users have a list of check boxes they can choose from. I want a text field to change colors according to which checkbox they select. I have worked through a few ways of doing this, and can make a check box change colors, but when I click off of said checkbox, it goes back to white (or blue as it appears to indicate it's a selectable field) and doesn't remain the color I need it to. 

 

The code I've tried is: 

event.target.fillColor = (color.equal(color.transparent, event.target.fillColor)) ? color.red : color.transparent;

 

Is there a way to make sure the checkbox stays red? Any help is greatly appreciated!

Views

1.4K

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
community guidelines
LEGEND ,
Oct 08, 2019 Oct 08, 2019

Copy link to clipboard

Copied

There are many places to place the JavaScript. Where exactly did you place the code?

Votes

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
community guidelines
New Here ,
Oct 09, 2019 Oct 09, 2019

Copy link to clipboard

Copied

LATEST
Thanks for your help! I put the script in the "Mouse Up" function. I have it set to "Run a JavaScrip" Is there a better way of doing this?

Votes

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
community guidelines