Copy link to clipboard
Copied
Error: At least one required field was empty. Please fill in the required fields (highlighted) before continuing
I have removed all of the required fields in my pdf but I am still getting this error. Is there a way to search for a required field that may be hidden?
Copy link to clipboard
Copied
Execute the following code in the interactive JavaScript console (Ctrl+J):
for (var i = 0; i < numFields; i += 1) {
var f = getField(getNthFieldName(i));
if (f && f.type !== "button" && f.required && !f.valueAsString) {
console.println("Name: " + f.name + "\tType: " + f.type + "\tPage: " + f.page);
}
}
If it indicates a field with a page of -1, it's on a hidden template.
Copy link to clipboard
Copied
With Javascript you can check the property required of the fields.
Copy link to clipboard
Copied
Execute the following code in the interactive JavaScript console (Ctrl+J):
for (var i = 0; i < numFields; i += 1) {
var f = getField(getNthFieldName(i));
if (f && f.type !== "button" && f.required && !f.valueAsString) {
console.println("Name: " + f.name + "\tType: " + f.type + "\tPage: " + f.page);
}
}
If it indicates a field with a page of -1, it's on a hidden template.
Copy link to clipboard
Copied
Good day
How do I add this script in the debugger ?
Thank you
J
Copy link to clipboard
Copied
Copy and paste.
Copy link to clipboard
Copied
I have tried to do this, however it does not allow me to type in the script area.
Copy link to clipboard
Copied
Please show a screen shot of what you are trying. Please DO NOT EMAIL IT.
Copy link to clipboard
Copied
This is the screen with the debugger. Where should I enter the script as it does not allow me to type anywhere.
Thank you
Copy link to clipboard
Copied
What happens when you type in the field at the bottom?
Copy link to clipboard
Copied
It does not allow me to type in any of the fields.
Copy link to clipboard
Copied
Repair your Acrobat installation.
Copy link to clipboard
Copied
Go to Edit - Preferences - JavaScript and tick "Enable interactive console".
Copy link to clipboard
Copied
That worked. Thank you.
Copy link to clipboard
Copied
I can now enter the script, however the result is "undefined" as per below.
Copy link to clipboard
Copied
"undefined" just means the script completed executing. It seems that no fields were found that match the criteria you specified.
Copy link to clipboard
Copied
My issue at the moment is as follows :
The form based on certain field values displays or hides other fields. I use the following to hide/un-hide and make fields mandatory.
//start of script
this.getField("PARTNER").required = (event.target.value!="Off");
this.getField("PARTNER").display = display.hidden;
If condition true
this.getField("PARTNER").display = display.visible;
this.getField("PARTNER").required = (event.target.value!="On");
When I submit the form, it gives the error of
I have manually gone through all the fields and un-selected "required" in the general tab, and this seems to work, however I need to ensure that based on key field values the information that is mandatory is filled before submitting.
Kindly advise.
Thank you
Copy link to clipboard
Copied
The following is not Javascript:
If condition true
Copy link to clipboard
Copied
Be sure to SELECT all of the script before you execute it, otherwise it only does the current single line. Weird editor.
Copy link to clipboard
Copied
Thank you for the replies.
From my investigation, I need to know how can I switch fields mandatory or not based on other field selections.
Thank you
J
Copy link to clipboard
Copied
Hi
The if condition is not the issue as it was a representation, however the actual code is :
//start of script
this.getField("PARTNER").required = (event.target.value!="Off");
this.getField("PARTNER").display = display.hidden;
if (event.value == "INDIRECT")
{
this.getField("PARTNER").display = display.visible;
this.getField("PARTNER").required = (event.target.value!="On");
}
Copy link to clipboard
Copied
Where does you use this script?
Copy link to clipboard
Copied
In Calculate tab, Custom Calculation script.
Copy link to clipboard
Copied
What values does you use in the field?
Copy link to clipboard
Copied
I assume you mean the fields that I wish to hide/unhide. These are text fields and can also be a drop down.
Copy link to clipboard
Copied
I mean the field with the calculation script.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now