Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Check Box Styles

Avatar

Former Community Member
How can I change the style of the Check box? Not the box itself, but change the X to an actual check mark?
5 Replies

Avatar

Former Community Member
Here's some script that can do it, put it in the doc:ready event of the check box.



var oDoc = event.target;

var f = oDoc.getField("form1[0].Page1[0].CheckBox1[0]");

f.style = style.ch;



You'll need to change the string passed into getField() to be the proper SOM expression for your checkbox.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Thank you Chris for your quick response. I got the check mark to come up, but there is an error associated with it.



Error Message:

Script failed (language is javascript; context is xfa[0].form[0].TopmostSubform[0].MainContent[0].CheckBox3[0]) script=var oDoc=event.target; var f=oDoc.getField("TopmostSubform[0].MainContent[0].CheckBox3[0]"); fstyle=style.ch;



The check mark is appearing, so I don't know what this error is about. Any thoughts?

Avatar

Former Community Member
No idea, the script looks good and I tried it here and it worked fine with no errors. Plus the fact that it works despite the error message is weird. What version of Acrobat/Reader are you using, I'll try it in that. I tried it in Acrobat 7.0.7.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Hi

I too have this requirement of displaying "tick" instead of a "cross" inside the check box.

It is working well with the codes until there is a dynamic codes being executed.(Setting a subform page previously hidden back to visible)

The previous "tick" check box will change back to a "cross".

I tried placing the codes in different event but the same thing still happened.

Anybody encountered this before?

Thanks

Avatar

Former Community Member
NEED SCRIPT HELP-CHKBX STYLE



Hello!



I am desparately trying to find out how the change the style of the checkboxes [STYLE & COLOR] ...While in Acrobat 7. there is no problem - there's a selection - how annoying.



Anyway I followed what Chris had posted...my problem is



1:that I don't work with scripting all that often and am not sure where to enter the script.



2: I'm not sure what to enter regarding: "You'll need to change the string passed into getField() to be the proper SOM expression for your checkbox"



This is where I am:



----- F.P1.CheckBox1::docReady - (JavaScript, client) ----------------------------------------------



var oDoc = event.target;

var f = oDoc.getField("form1[0].Page1[0].CheckBox1[0]");

f.style = style.ch

- (JavaScript, client) ----------------------------------------------



I am in the process of developing my forms skills and this has just been driving me crazy!!



Thank you for any help anyone could provide.



Ruthann