Hariharbalaji
Hariharbalaji

Reputation: 2578

How to Disable components onClick of a Button in JSF?

In my application i have three buttons, If i click on one button I have to disable all the button till the operation on that button is finished.

I dont know how to disable the other two buttons. Kindly help.

Upvotes: 2

Views: 2856

Answers (1)

BalusC
BalusC

Reputation: 1108537

Use JavaScript to get the HTML element from the DOM and then set its disabled attribute.

document.getElementById('clientId').disabled = true;

Note that the 'clientId' is the autogenerated HTML element ID. Rightclick page and View Source to find it out. If this contains prefixes like j_id and so on, then you need to give all parent UINamingContainer components like <h:form>, <h:dataTable>, <f:subview> and so on a fixed component ID, so that the client ID doesn't need to be autogenerated anymore.

Upvotes: 1

Related Questions