1 Reply Latest reply on Feb 16, 2010 10:00 AM by Steffen Müller

    Required validation in a custom composition

    Steffen Müller Newbie

      Hi everybody,

      we built a custom facelet control which combines an inputText, an add-button and an orderingList in one control named multilist. When you type something in the inputText, you can add this text from the inputText to the orderingList by clicking the add-button. The control is ajax-enabled, so if nothing is in the list, the list is not rendered. This is a user requirement to reduce the space in the view, when there is nothing in the list. After adding the first value to the list, the list is rendered and the values are displayed. This works fine.

      But now we sometimes have to ensure, that the user must add at least one value to the orderingList in this custom control (just like the required-Attribute in a default jsf control). But we cannot set the required attribute at the orderingList, because it's not rendered, if there is nothing in the list.

      Is it possible to trigger the required validation from the facelet control without writing a custom validator or using a validation method in a backing bean? We just want to use the required attribute like in a default jsf control: <multilist id=... required="true">. Is it possible? Do we have to write our own jsf control or our own tag handler or is not possible?