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

Multichoice check boxes

Community Beginner ,
Nov 10, 2016 Nov 10, 2016

I need to make a checkbox with three options. Checked, not checked, or a dash. I can sort of do this with a dropdown box, but was wondering if there was a way to do it with a checkbox.

TOPICS
PDF forms
1.2K
Translate
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
1 ACCEPTED SOLUTION
LEGEND ,
Nov 10, 2016 Nov 10, 2016

Not with an actual check box, but you can fake it using a button. The following demo uses a button and text field combination. The button provides the UI and appearance, and the text field provides the means to get/set the value of what I call the composite field. It relies on JavaScript, so you'll have to study it to see how it works, and it won't work on most non-Adobe PDF viewers and most mobile PDF viewers.

Demo: http://www.acroscript.net/pdf/demos/multistate_4.pdf

Things can be simplified if you don't need to worry about getting/setting or importing/exporting the field value, but I don't have a demo for that.

View solution in original post

Translate
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 ,
Nov 10, 2016 Nov 10, 2016

Not with an actual check box, but you can fake it using a button. The following demo uses a button and text field combination. The button provides the UI and appearance, and the text field provides the means to get/set the value of what I call the composite field. It relies on JavaScript, so you'll have to study it to see how it works, and it won't work on most non-Adobe PDF viewers and most mobile PDF viewers.

Demo: http://www.acroscript.net/pdf/demos/multistate_4.pdf

Things can be simplified if you don't need to worry about getting/setting or importing/exporting the field value, but I don't have a demo for that.

Translate
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
Community Beginner ,
Nov 10, 2016 Nov 10, 2016

The Multistate Checkbox is pretty much exactly what I need. I am nowhere an expert with Java though. Often I have found I can copy past just enough to get by. I copied both boxes and copied the script into "document Java Script" under "init" but the icons don't appear on my document. Also I need to change the X to a dash. Heavy Minus sign 2796 looks about right but I don't seem to be changing the entry correctly as it just stays an X.

Translate
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 ,
Nov 10, 2016 Nov 10, 2016

If you're able to post your form somewhere and provide a link here, I'd be happy to take a look. If you can't, feel free to email me at: acroscript at gmail dot com

Translate
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
Community Beginner ,
Nov 11, 2016 Nov 11, 2016

Thanks I sent you a copy of the PDF I am working with.

Translate
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 ,
May 30, 2023 May 30, 2023

This is exactly what I need to do, but the PDF file listed in the answer is no longer available.

Can anyone help?

Thanks!

Translate
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
Community Expert ,
May 30, 2023 May 30, 2023
LATEST

What exactly are you trying to achieve?

Here is script for button that will change on each click: blank, green checkmark, red dashes:

if (event.target.buttonGetCaption()=="\u2714") {

event.target.buttonSetCaption("---");

event.target.textColor = color.red;

} else if (event.target.buttonGetCaption()=="---") {

event.target.buttonSetCaption("");

} else if (event.target.buttonGetCaption()=="") {

event.target.buttonSetCaption("\u2714");

event.target.textColor = color.green;

}

Translate
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