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
SOLVED

Toggle show/hide mandatory field based on a checkbox

Avatar

Level 3

I want to show/hide a textfield(required: true) based on a checkbox.

Only when checkbox is enabled, textfield must be displayed 

Only when checkbox is disabled, textfield must be hidden.

 

When checkbox is disabled, I am unable to submit the dialog since textfield is a required field.

 

Expected: When checkbox is disabled, I should be able to submit the dialog even though textfield is a required field.

Please help.

Thanks in advance

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You need to write a script to toggle required and disabled attribute for TextField on checkbox state change 

0 Replies

Avatar

Correct answer by
Community Advisor

Hi,

You need to write a script to toggle required and disabled attribute for TextField on checkbox state change