开发者

Icefaces: Disable validations with checkbox or similar

开发者 https://www.devze.com 2023-02-19 10:52 出处:网络
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

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

精彩评论

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