required property for alt text in image component does not work

Avatar

Avatar

anilm50076901

Avatar

anilm50076901

anilm50076901

06-03-2020

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

09-03-2020

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;
}
  }
});

 

Answers (0)