Reputation: 111
<p:calendar ... disabled="#{bean.disabled}" />
When enabled, you can see the button that opens the popup:
When disabled, this button disappears:
I would like to show button in disabled mode too. How can I achieve this?
Upvotes: 1
Views: 2250
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
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