Pat
Pat

Reputation: 613

Disable DatePicker icon trigger when date textbox is disabled

I have implemented the date picker as below:

$( ".apprvd_input_date" ).datepicker({
   changeMonth: true,
   changeYear: true,
   showOn: "both",
   buttonImage: "../resources/images/date_picker.gif",
   buttonImageOnly: true                   
});

I have <h:inputText disabled="#{bean.readOnly}" styleClass="apprvd_input_date" size="8"/> I control the disabled property from bean variable and now the text box is disabled but still it allows me to pick the date using date picker. Can i hide the date picker icon on when it is disabled? I have around 10 textboxes using the date picker and wanna to do it for all.

Upvotes: 1

Views: 3953

Answers (1)

Nitesh
Nitesh

Reputation: 1550

You will have to manually hide that date picker icon as:

fiddle: https://jsfiddle.net/rmdf32za/

function disableDate(){
  $(".ui-datepicker-trigger").addClass("hide");
  $(".apprvd_input_date").attr("disabled","disabled");
}

.hide{
  display:none;
}

Upvotes: 1

Related Questions