These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How do you make a Text field "Check" a Check box given a certain value?

Pyro
Registered: Feb 23 2011
Posts: 1

I would like to automaticly "check" a Check box if a certain value is entered in a Text field.
 
The Text field is Named "Puls" and The Check box is named "Puls>120" and I would like the Check box to be "checked" if the value in the Text field is >120 or <40.
 
Any ideas as how to do this?
I have been looking around and trying different scripts but unfortunatly gotten nowhere.
Need help !

My Product Information:
Acrobat Pro 9.4.2, Windows
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1875
Try something like the following as the text field's Validate script:

  1. // Custom Validate script
  2. (function () {
  3.  
  4. // Get a reference to the check box
  5. var f = getField("Puls>120");
  6.  
  7. // Get this field's value as a number
  8. var nVal = +event.value;
  9.  
  10. // If this field has a value (is not blank)...
  11. if (event.value) {
  12.  
  13. if (nVal > 120 || nVal < 40) {
  14. f.value = "Yes"; // set to export value of check box
  15. } else {
  16. f.value = "Off";
  17. }
  18. } else {
  19. event.value = "Off";
  20. }
  21.  
  22. })();
This assumes the field can only contain a number. You might consider adding additional code to ensure that the entry is a positive number within a reasonable range. Change "Yes" above to whatever the export value of the check box is.