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

How to change checkbox color when it is checked?◘

New Here ,
Feb 13, 2021 Feb 13, 2021

Copy link to clipboard

Copied

I'm creating a exam with multiple choices per question. The idea is to, when the student clicks on one of the chekboxes, he receives a feedback color on that checkbox through colors.

A simple system with  red when wrong and green when right.

 

In the forms options I didn't find nothing like that, and the only alternative I found was to create a JavaScript, but I don't know anything about that.

 

I anexed a example file. The checkboxes are placed, but a just don't know how to gave this system with the colors.

TOPICS
Create PDFs , How to , JavaScript , PDF forms

Views

2.8K

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

correct answers 1 Correct answer

Community Expert , Feb 13, 2021 Feb 13, 2021

You want to change fill color or border color?

You can aproach this a few way, simpliest being just change color (Il use fill color as example) when checkbox is clicked,

since you use checkboxes as radio buttons, you can use this code in first checkbox as Mouse UP event, where "0" in field name represent field widget (In a group first field will have widget 0, second will have 1, then 2,3...etc)

if(this.getField("eqexam.Part1.2.0").value != "Off"){
this.getField("eqexam.Part1.2.0").fillColor = colo
...

Votes

Translate

Translate
Community Expert ,
Feb 13, 2021 Feb 13, 2021

Copy link to clipboard

Copied

LATEST

You want to change fill color or border color?

You can aproach this a few way, simpliest being just change color (Il use fill color as example) when checkbox is clicked,

since you use checkboxes as radio buttons, you can use this code in first checkbox as Mouse UP event, where "0" in field name represent field widget (In a group first field will have widget 0, second will have 1, then 2,3...etc)

if(this.getField("eqexam.Part1.2.0").value != "Off"){
this.getField("eqexam.Part1.2.0").fillColor = color.red;}

In the second checkbox replace "0" with "1" in third checkbox with "2"...etc

also change "red" to "green" in a checkbox you want to be green.

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