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
BedrockMission!

Learn More

View all

Sign in to view all badges

Can't validate value of disabled field in AEM

Avatar

Avatar
Validate 10
Level 3
bhoang
Level 3

Likes

11 likes

Total Posts

92 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 10
Level 3
bhoang
Level 3

Likes

11 likes

Total Posts

92 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile
bhoang
Level 3

10-05-2018

Hi,

I am created some fields in AEM as textfield with required Boolean = true . So I am using javaScript to disable that field when the user checked to a checkbox fields.

Example: propertyName and city are mandatory fields. required Boolean = true

$("coral-select[name='./ppdPropertySelect']").prop("disabled", true);

$("#syndft").change(function(){

var checked=this.checked;

if(checked==true) // "this" refers to the element that fired the event

    {

          $("coral-select[name='./ppdPropertySelect']").prop("disabled", false);

          //disable sync field

        $("input[name='./propertyName']").prop("disabled", true);

          $("coral-select[name='./city']").prop("disabled", true);

    }else{

          $("coral-select[name='./ppdPropertySelect']").prop("disabled", true);

          //disable sync field

         $("input[name='./propertyName']").prop("disabled", false);

          $("coral-select[name='./city']").prop("disabled", false);

    }

});

I have a javascript to auto fill data in to propertyName and city. The field have a data but it doesn't pass the validation as attached image.

validation-error.PNG

The AEM have the errors when I using disabled fields as below.

aem-error.PNG

When I remove the code disabled field, it work fine.

Why AEM have error and wrong validation with disabled fields?

How to fix it?

Thank you so much,

BienHV

Replies

Avatar

Avatar
Springboard
Level 9
Gaurang
Level 9

Likes

143 likes

Total Posts

435 posts

Correct Reply

45 solutions
Top badges earned
Springboard
Validate 100
Validate 50
Validate 25
Validate 10
View profile

Avatar
Springboard
Level 9
Gaurang
Level 9

Likes

143 likes

Total Posts

435 posts

Correct Reply

45 solutions
Top badges earned
Springboard
Validate 100
Validate 50
Validate 25
Validate 10
View profile
Gaurang
Level 9

12-05-2018

Hi,

I'm moving this query in the relevant community to be addressed.

Thanks,

Gaurang

Avatar

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile
Hemant_arora
Level 7

13-05-2018

Can you share the package ?

Also can you make it readonly instead of disabled. That should work

Avatar

Avatar
Validate 10
Level 3
bhoang
Level 3

Likes

11 likes

Total Posts

92 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 10
Level 3
bhoang
Level 3

Likes

11 likes

Total Posts

92 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile
bhoang
Level 3

16-05-2018

Thank you so much,

The readonly can help me get the field value. However, It wrong when i want to validate the fields. Can't validate the readonly fields.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

16-05-2018

I am confused - if the field is read-only and a user cannot enter data into that given field - why validate a read only field?

Avatar

Avatar
Validate 10
Level 3
bhoang
Level 3

Likes

11 likes

Total Posts

92 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 10
Level 3
bhoang
Level 3

Likes

11 likes

Total Posts

92 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile
bhoang
Level 3

18-05-2018

I want to validate a read only field or disabled field because I must sync data from other site and fills it into our form. I don't want the user can edit the data when it sync form other site.

Thank for your help,