0
votes

When I try to disable commandButton the disabled attribute doesn't call the method in Bean that checks if the variable is true or false. However, i tried rendered attribute and it's working! What's even weirder I work on the same project as my friend on a different device and disabled works for him on the same code as mine. What kind of magic is this?

                                <p:commandButton value="raport" id="raportId"
                                icon="content_paste" style="min-width:80px"
                                actionListener="#{rekrutacjaWniosekBean.raport()}"
                                disabled="#{rekrutacjaWniosekBean.czyNowy}"
                                styleClass="ctl-home-link-menu"
                                onclick="form.target = '_blank'" ajax="false">
                            </p:commandButton>

In Bean, there is only simple getter and setter but they're never called with disabled on my device.

    public boolean isCzyNowy() {
    return czyNowy;
}

public void setCzyNowy(boolean czyNowy) {
    this.czyNowy = czyNowy;
}
1
it could be that the boolean you are using czyNowy is null, you have to set an initiale value to true or false - Bilal Dekar
@Billy DEKAR The boolean (primitive) data type can never be null, for this it would have to be Boolean (Object). The default value for a boolean (primitive) is false. - borchvm

1 Answers

0
votes

There could be one reason is you need to update the commandButton component after you disable.

RequestContest.getCurrenteInstance.update("raportId"); add above line in your coding after you disable the component