开发者

Icefaces: Disable validations with checkbox or similar

I want to disable the required attribute of the inputText, or any other validator, depending on the value of 开发者_如何学Pythonthe selectBooleanCheckBox when I click on the Save Button, How I can do it?

I tried this, but with not result.


This could be done with letting the value of the checkbox controll the required attribute of the inputText. With partialSubmit="true" on selectBooleanCheckbox you can trigger the required value also if you want to validate the inputText value when losing the focus on inputText.

For Example:

view.xhtml

<ice:inputText required="#{mybean.inputRequired}" .../>
<ice:selectBooleanCheckbox 
    value="#{mybean.inputRequired}"
    partialSubmit="true".../>

MyBean.java

public class MyBean {
    private boolean inputRequired;

    public boolean isInputRequired() {
        return inputRequired;
    }

    // setter and other stuff
}

myBean has to have at least extended request scope.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜