How to make a field mandatory depending on another


On the create view of one of my documents I have a list box with 3 values: a, b, c, and a date picker.

I need the date to be set as mandatory only if a or b is present in the list box.

I've been reading here and there about JSF and found that the most approaching answer was given by this topic on stackoverflow:

But when I try to reproduce this kind of declaration inside my layout definition, it just doesn't work.

Can anyone please share a sample ?

0 votes

1 answers



Thanks you! For any reason I had to use getSubmittedValue() instead of getLocalValue() to get it done.

That's the right one to use when dealing with an input component: that's the value as submitted, before validation (when validation passes, this value is emptied and copied to the "local" value).

Thanks for this usefull precision

Hey Antoine Cordier,did you achieve this in client side without pressing the submit button?