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

Turn on/off textbox vallue based on checkbox

kentwatchlight
Registered: Feb 13 2009
Posts: 30
Answered

I have a checkbox designating a service. I have a hidden textbox with the default value of that service (6). How do I make the checkbox act as a toggle to either designate the textbox as 6 (if checked) or 0 (if unchecked)?

kentwatchlight
Registered: Feb 13 2009
Posts: 30
(function () {

//Get Checkbox value
var v1 = getField("Check Box1").value;

//Get Reference to text field
var f1 = getField("Text1");

//Set Text value according to checkbox value
if (v1 !== "Off") {
f1.value = 6;
} else {
f1.value = 0;
}

})();