Alice
Alice

Reputation: 111

<p:calendar> button is hidden when disabled="true", how to make it appear anyway?

<p:calendar ... disabled="#{bean.disabled}" />

When enabled, you can see the button that opens the popup:

Here you can see the button that call to pop up calendar

When disabled, this button disappears:

Now this button disappear in disabled mode

I would like to show button in disabled mode too. How can I achieve this?

Upvotes: 1

Views: 2250

Answers (2)

ben abdallah anissa
ben abdallah anissa

Reputation: 11

// this function make the button in disabled mode
function disableCalendar(){
    $(".ui-datepicker-trigger ").prev().attr("disabled","disabled");
    $(":button").filter(".ui-datepicker-trigger ").attr("disabled","disabled");

}
// this function remove the disabled mode
function abilitaCalendar(){
    $(":button").filter(".ui-datepicker-trigger ").removeAttr("disabled");
    $(".ui-datepicker-trigger ").prev().removeAttr("disabled");
}

Upvotes: 1

gybandi
gybandi

Reputation: 1898

Judging from the 'p:' tag prefix, I imagine you use primefaces.

The button is disabled, because it makes no sense for the popup to appear, the user won't be able to modify the date in the component.

What do you want to achieve?

If you want to disable the input textbox and force the user to use the date picker popup, you can use the readonlyInput=true property.

Upvotes: 3

Related Questions