Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Possible to add class tags to form fields?


Level 1

Is it possible to add class tags onto form fields? I need a function that highlights empty fields on a form that are indicated that they should be highlighted when empty, so not all empty fields, just the ones indicated. If a class tag or some other method could be used, and then loop through all fields and highlight those with the tag, that would greatly simplify the way we are currently doing it.


3 Replies


Level 10

Hi there,

I've made a good form with examples for validation, reset and multiple other functions.

You can use this form template for your needs


Validation / Reset Functions, easy to manipulate and to change Forms!!!!


Level 1

Thank you for your response. Sorry I need to clarify, the highlighting is not for validation, it is to be printed on the completed PDF for end-users to know what fields they need to complete by hand. We need to change the fill color of the fields so that they print with the highlighting. My question is whether a class can be applied to fields so that we can access and apply a fill color to all fields with that class.


Level 10

Well the functionality for validation can still be used for your needs. If you change a little bit the code, just to change all the field's color, you don't need to verify if validation script returns a null field, you can just print once the validation code has run.

The validation script will look for all fields with null value and change their borders to red as needed.

I don't think it would be possible to create a class just like in HTML for all objects you want to apply fill color like CSS code, you would probably need to apply this with JavaScript when the print event is fired.

Otherwise, maybe another way would be having a function like ChangeColorField like in my PDF and call that function on pre-print event of each fields you want to change the fill color.