views:

389

answers:

1

Hi, I have a form with 3 fields (simplyfied example).

The first one is a checkbox.

<ice:selectBooleanCheckBox value="#{backingBean.bean.visible}" ID="checkbox1" partialSubmit="true" >

The second one is a

<ice:inputText ID="text1">

The third one is also a

<ice:inputText ID="text2" required="true" validator="mycustomvalidator">

text1 should only be visible when checkbox1 is checked. text2 is a required field and has customvalidator set.

So my first approach with just using #{backingBean.bean.visible} failed because text2 has is required and a validation message appeared (after the checkbox was clicked) when the text2 field is empty. Because of ths valdation error the form was never completely submitted such that the visible property is set (update model phase was never reached).

I also tried to use immediate="true" for the selectBooleanCheckBox but that only had the consequence that the validation message for the required="true" disappeared but the validation of mycustomvalidator still triggered.

So my question: how can I make sure text1 is only visible when checkbox1 is clicked? Thanks.

A: 

To give an answer here, I think the best solution is to use client side Javascript for hiding/showing the elements.

hubertg