I'm new to Java and Acrobat 9. I want to calculate a form and have the submit button grayed out until all the check boxes have been checked. This is my code, it works checking up to 17, but if I uncheck any boxes the submit button becomes available at 15 and 18, what am I doing wrong?
// Function to enable form fields
function EnableFormField (Print)
{
// First acquire the field to be enabled
var oFld = this.getField(Print)
// Next acquire the hidden field with the normal colors
var oNmlFld = this.getField("Print/Send");
if(oFld)
{
// Make field interactive
oFld.readonly = false;
// Restore Normal Colors
oFld.fillColor = oNmlFld.fillColor;
oFld.borderColor = oNmlFld.borderColor;
oFld.textColor = oNmlFld.textColor;
}
}
// Function to disable form fields
function DisableFormField(Print)
{
// First acquire the field to be disabled
var oFld = this.getField(Print)
if(oFld)
{
// Make field Read-Only
oFld.readonly = true;
// Set Grayed out colors
oFld.fillColor = ["G", 0.75];
oFld.borderColor = ["G", 2/3];
oFld.textColor = ["G", 0.5];
}
}
And in the actual field under the "custom validate" tab:
if(this.getField("Sum").value =="16")
EnableFormField("Print");
if(this.getField("Sum").value <"16")
DisableFormField("Print");if(this.getField("Sum").value >"16")
DisableFormField("Print");
If they are numberic values, test them as numbers and not strings.
Because check boxes can have assigned values or a value of "Off", what is the script that sums the check boxes?
George Kaiser