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

Submit button highlights required fields that are already filled in

buddenceq
Registered: Dec 3 2007
Posts: 17

I'm using Acrobat 8.1.2 on a mac. I've created a form that has a submit button and 2 required text fields. They are both set to "required" so they have to be filled out to submit the form. But the problem is if I fill in only 1 of the two required fields and hit submit, they both come up with the red highlight on them indicating that they have not been filled in yet. Yet, if I then fill in the 2nd text field, it works fine. How can I get Acrobat to not highlight ALL of the text fields if only one of them is not filled in?

My Product Information:
Acrobat Pro 8.1.1, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I believe the hightlight is for "required" field's, not "Unfilled" fields. If you want to highlight the "Unfilled" fields, you'll need to put in your own checking by adding a JavaScript action to the submit button. This is not a hard JavaScript: Here's a simple example, place it in a "Run a JavaScript" action in the submit button's MouseDown event.

app.runtimeHighlight = false;
for(var i=0;i<this.numFields;i++)
{
var cFld = this.getNthFieldName(i);
var oFld = this.getField(cFld);
if(oFld.required && oFld.value == "")
oFld.fillColor = color.red;
else
oFld.fillColor = color.transparent;
}

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

buddenceq
Registered: Dec 3 2007
Posts: 17
Sorry I may have confused you by saying "highlight". Both text fields are "required fields" and when I hit the submit button if only one of the to fields are filled then BOTH are identified as required fields that need to be filled in before the form can be submitted.(they are both marked in red) Shouldn't only the field that was not filled out come up marked in red. (as opposed to both)
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
No, they are still both required whether or not they are filled in or not.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

buddenceq
Registered: Dec 3 2007
Posts: 17
I think there may be some miscommunication here. I will try to explain more clearly.

I've made a form. It has 3 elements. (Text field "A", Text field "B" and a submit button)

Both text field "A" and "B" are set to required.

If I enter text into "A" and hit submit I get the following message. "At lease one required field was empty on export. Please fill in the required fields (highlighted) before continuing)

Now this is the part that I think we are not understanding each other:

If Acrobat is working properly, it should highlight ONLY the required fields that still need to be filled in. (Text Field "B")

But the problem is that it is highlighting both fields even though the one is already filled in.

If it makes it easier to understand just create 2 text fields and a submit button and only fill in one of them and hit submit. You will see that Acrobat highlights both fields.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
What makes you think that Acrobat is supposed to highlight only unfilled, required fields? Have you ever seen this behavior in Acrobat before? Is it explained like this in the documentation?

Believe me, I've done this before. I never misunderstood your quetsion. Acrobat highlights the "Required" fields. It doen't matter if they are filled in. Here is a direct quote from the Acrobat Help on the form hilighting preference.

****
Required Fields Highlight Color Opens a color picker for selecting the border color of form fields that must be filled in. The border appears for required form fields only after you attempt to submit the form.
****

It doesn't say anything about fields being filled in or not and it works the same on Acrobat 7.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script