Copy link to clipboard
Copied
HI Forum experts ,
I have created an interactive PDF form with check-boxes and text fields. I wanted to know if it is possible for 'checkbox 1' to tick, when 'text field 1' has had text entered (JavaScript on the textbox?). The check-boxes will be on another page and will track the progress of text box completion over time.
(The form is going to be used for an ongoing audit).
If you know of a JavaScript / or how to do this - that would be greatly appreciated. Many thanks - Kind regards Kevin
1 Correct answer
Sure, it's possible. Enter this code as the custom validation script of the text field:
this.getField("checkbox 1").checkThisBox(0, (event.value!=""));
You can set the check-box as read-only to prevent the user from changing its value manually.
Copy link to clipboard
Copied
Sure, it's possible. Enter this code as the custom validation script of the text field:
this.getField("checkbox 1").checkThisBox(0, (event.value!=""));
You can set the check-box as read-only to prevent the user from changing its value manually.
Copy link to clipboard
Copied
Brilliant! really helpful - many thanks.
Copy link to clipboard
Copied
Oh- PS greatly appreciate if you can help me with this (similar question): How to make 'checkbox 1' tick when 'signature 1' is signed. (I have tried to use previous script). Appreciate thanks Kevin
Copy link to clipboard
Copied
PPS please ignore - your script works perfectly on my second question also. Kind regards Kevin
Copy link to clipboard
Copied
Hi Try67,
Sorry to be a pain a variation on the above: Do you know if it is possible to have three text fields, and a check box, and the check box only ticks when all three text fields have had text entered? if so the JS for that would be fantastic. Appreciated - Kind regards Kevin
Copy link to clipboard
Copied
The easiest way is to create another (hidden) text field and then enter this code as its custom calculation script:
var v1 = this.getField("Text1").valueAsString!="";
var v2 = this.getField("Text2").valueAsString!="";
var v3 = this.getField("Text3").valueAsString!="";
this.getField("checkbox 1").checkThisBox(0, (v1 && v2 && v3));
Copy link to clipboard
Copied
Many thanks for the quick reply: I haven't been able to get this to work, the check box only ticks when I enter text for the three text boxes and the hidden text box. Thanks Try67 - Anymore help greatly appreciated. Many Thanks Kevin
Copy link to clipboard
Copied
The hidden text box doesn't play a role in this code... Can you share you file?
Copy link to clipboard
Copied
Many thanks for your help, I have made a test document, how do I attach and send?
Copy link to clipboard
Copied
Upload it to something like Dropbox, Google Drive, Adobe Cloud, etc., and post the link to it here.
Copy link to clipboard
Copied
Thanks Try67 Link is here: Dropbox - TEST Document.pdf
Copy link to clipboard
Copied
You didn't put the script where I said it should be placed.
Copy link to clipboard
Copied
Thanks for looking at this so promptly. I applied to 'Text4' which would be the hidden field. (I'm misinterpreting instructions). Sorry can you tell me which field it would apply to? Thank-you this is so appreciated. Kevin.
Copy link to clipboard
Copied
Updated doc: Dropbox - TEST Document vs 1.1.pdf
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You placed the code as a validation script, not a calculation script as advised. It will work when you change it.
Copy link to clipboard
Copied
Thank-you! George, and Try 67.
This is brilliant. I'm extremely grateful for your time, and expertise. It is perfect as it unchecks if the form is updated also.
I do have another question (slight variation to above).. I'll post on this thread if OK.
Kind regards
Kevin
Copy link to clipboard
Copied
Hi Again, I would be grateful - if you can also help me with this (variation to above):
Is it possible to have 4 text fields, which activate a check box if at least one of them have text entered?
The JS for that would be fantastic. (I'll put it in correct place)
Again - really appreciated - thanks Kevin
Copy link to clipboard
Copied
Use this code:
var v1 = this.getField("Text1").valueAsString!="";
var v2 = this.getField("Text2").valueAsString!="";
var v3 = this.getField("Text3").valueAsString!="";
var v4 = this.getField("Text4").valueAsString!="";
this.getField("checkbox 1").checkThisBox(0, (v1 || v2 || v3 || v4));
Copy link to clipboard
Copied
Perfect! Many thanks.
I see some of the patterns in the JS - so this is definitely inspiring me to learn to a basic level. I may have one last question ... if OK I'll post on this thread.
Thanks again
Kind regards Kevin

