required property for alt text in image component does not work | Community
Skip to main content
anilm50076901
New Participant
Mar 6, 2020 8:00 PM UTC
Solved

required property for alt text in image component does not work

Hi 

 

AEM 6.3

 

I have set "Alternative Text" under Accessibility tab of image component to mandatory (required true).

 

On form submission field gets highlighted but form submission continues.

 

Any help to fix this? i want to make Alt text field mandatory for image component.

 

image supertype: /wcm/foundation/components/image

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Mar 9, 2020 1:39 PM UTC

It should work, it could be a bug.

Anyways top of that you can add a extraclientlibs to validate img alt and stop dialog submit.

 

(function ($, $document) { "use strict"; $(document).on("click", ".cq-dialog-submit", function (e) { var $inputEle = $('[name="./alt"]'); if($inputEle !== null || typeof $inputEle !== "undefined") { var altValue = $inputEle.find("input.coral-Textfield").val(); if(altValue === "") return false; } } });

 

Arun Patidar

3 replies

arunpatidar
arunpatidarAccepted solution
New Participant
Mar 9, 2020 1:39 PM UTC

It should work, it could be a bug.

Anyways top of that you can add a extraclientlibs to validate img alt and stop dialog submit.

 

(function ($, $document) { "use strict"; $(document).on("click", ".cq-dialog-submit", function (e) { var $inputEle = $('[name="./alt"]'); if($inputEle !== null || typeof $inputEle !== "undefined") { var altValue = $inputEle.find("input.coral-Textfield").val(); if(altValue === "") return false; } } });

 

Translate
Arun Patidar
anilm50076901
New Participant
Mar 10, 2020 8:00 PM UTC

Thanks Arun. Unfortunately, this code is not working.

 

tried to trace the control for my script but control is not coming over here

 

 

Translate