Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Can't select and other option after selecting one option.

Avatar

Level 2

Hallo all,

I've made a form, witch is very advanced i think, and in this form I used the .mandatory option.

I've an dropdown box, and this dropdownbox controls if the other dropdownbox is required or not. I've turned on the binding and it's so that if you select option 2 the other dropdownbox isn't required, but if you select option 1 or 3 the dropdownbox must be required. Now the problem is that if you select option 2, then you can't change you selection.

Here's the code.

if

(this.rawValue = 2)

{

     Cel6.mandatory

= "disabled";

}


else


{


     Cel6.mandatory

= "error";

}

What is wrong with this code?

greetings,

Timo

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Timo,

When scripting an if statement, you need a double equals sign in the test:

if (this.rawValue == 2)

{

     // ...

}

Also when dealing with dropdown I would place the script in the exit event, as the selection has been regiseterd at that stage and you can use .rawValue.

Should work then,

Niall

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

Hi Timo,

When scripting an if statement, you need a double equals sign in the test:

if (this.rawValue == 2)

{

     // ...

}

Also when dealing with dropdown I would place the script in the exit event, as the selection has been regiseterd at that stage and you can use .rawValue.

Should work then,

Niall

Avatar

Level 9

Hi,

Try this one in the change event of the dropdown.

var a = xfa.event.change;
if (a == 2)
    {
        Cell6.mandatory = "disabled";
    }
   
else
    {
        Cell6.mandatory = "error";
    } 

Thanks,

Bibhu.

Avatar

Level 9

Hi Niall,

I did not see your reply while I was replying. Sorry

Bibhu.

Avatar

Level 10

Hi Bibhu,

No problem! It happens all the time

Niall

Avatar

Level 2

Hi Niall,

Thank you. This was the answer.

Greetings,

Timo