Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Validating and highlighting a form fields.

Avatar

Level 3

Hi all!

I have a form, with a lot of fields, which must be NOT blank. And they must NOT be highlighted.

So, on the one hand: i have to make these fields required, for don't let users print the form with blank fields. But if I’ll do it with standard settings, the fields will be highlighted with a red color (default settings of the acrobat reader). Yes, these settings can be changed in Acrobat Reader, but as the form will be used by a lot of users - i can't force them all change their settings.

On the other hand: If the form fields are set to be optional, then validation scripts don't work on empty fields.

So, is there any ways to solve this problem?

2 Replies

Avatar

Former Community Member

In the script editor under the docReady event, enter:

form1::docReady - (JavaScript, client)

app.runtimeHighlight = false;

This will turn off the required field highlight by default but will allow the user to turn highlighting back on in Reader by clicking the Highlight Existing Fields button.

Avatar

Level 3

Well, then not only red borders disapper, but also the blue highlight of fields background, so, users can't see where to type text. And that is bad(

So, the only way i can see - is to turn off highlight (app.runtimeHighlight = false;), and also, chance fields fillColor, like that:

enter: this.fillColor = "255,255,255";

initialize: this.fillColor = "204,215,255";

exit: this.fillColor = "204,215,255";

prePrint: this.fillColor = "255,255,255";

But this way there will be a lot of "monkeyjob" to change color setting of every field...