Skip to main content
Participant
August 2, 2021
Question

Can you change the symbol in a checkbox on click?

  • August 2, 2021
  • 2 replies
  • 5932 views

I would like to create a form that has checkboxes that when clicked once are an X and when clicked twice are a checkmark. Is this possible or do I need multiple checkboxes, one for x's and one for checkmarks? 

This topic has been closed for replies.

2 replies

bebarth
Community Expert
Community Expert
August 2, 2021

Here is an example with a 3-option check box.

Thom Parker
Community Expert
Community Expert
August 2, 2021

While the checkbox does loop through the different styles, the value of the checkbox is the same for both cross and check, so it's not a true 3-state check. This technique is also potentially problematic in Reader, since changing the style officially requires form rights. You'll need to use a variation or a different technique if you will need the 3-State value.

Also keep in mind that this type of scripting will only work in a few of the better PDF viewers.     

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
bebarth
Community Expert
Community Expert
August 4, 2021

You are right, this example was a 3-option and not a 3-state check box. It was an example I did a few years ago for somebody who didn't need export values. But that doesn't mean it is not possible. Attached is an other example with multi-state check boxes. There are several ways to do that in accordance with what we need at the end.

You are right about the JavaScript and pdf viewers too, but if we only have to write for what is understood by all viewers, we won't write very much anymore.

Nesa Nurani
Community Expert
Community Expert
August 2, 2021

You can loop through checkbox style on click but not sure how you imagined clicking twice?

You can read here how checkbox style is changed and you can adapt code to use on click in checkbox:

https://community.adobe.com/t5/acrobat/changing-check-box-style-for-entire-document/m-p/12082784 

 

Participant
August 2, 2021

Hi Nesa,

 

Thanks for your response. What I'm hoping is that the client is able to click the box and as you said, loop through two different checkmark options. For example, click once, it's a checkmark. Click again, it's an X. Click again, it's blank. Click again, it's a checkmark, etc. etc. 

 

Does that make sense? Is your proposed solution still accurate for this situation? 

 

Thanks for your help!

Nesa Nurani
Community Expert
Community Expert
August 2, 2021

EDIT: I just saw post by bebarth, I belive he answered your question.