Copy link to clipboard
Copied
I have scoured the forums and tried several different scripts and adapted them for my use successfully but I cannot seem to get this action for my checkbox on my form to work.
I am editing and updating a PDF form.
I have a checkbox named cbApproval.
When this box is checked, I would like the text field below it named ApprovalOnlyStatement to appear with the sentence "APPROVAL ONLY"
If the box is not checked, the text box should disappear and the user will need to move on to type in a justification in a larger text field underneath - probably not relevant information for this.
All I want is for the sentence to appear when the box is checked. Help?
Thank you
This can be done with a single text field, and the script you'd use in the check box would be simpler. The Mouse Up script of the check box could be:
// Mouse Up script of check box
(function () {
// Get a reference to the text field
var f = getField("ApprovalOnlyStatement");
if (event.target.value === "Off") {
f.value = ""; // Blank the statement field
f.readonly = false; // Allow user to enter text
} else {
f.value = "APPROVAL ONLY"; // Set field
...
Copy link to clipboard
Copied
This can be done with a single text field, and the script you'd use in the check box would be simpler. The Mouse Up script of the check box could be:
// Mouse Up script of check box
(function () {
// Get a reference to the text field
var f = getField("ApprovalOnlyStatement");
if (event.target.value === "Off") {
f.value = ""; // Blank the statement field
f.readonly = false; // Allow user to enter text
} else {
f.value = "APPROVAL ONLY"; // Set field text
f.readonly = true; // Don't allow user to enter text
}
})();