How to disable onClick components of a button in JSF?

I have three buttons in my application. If I click on one button, I have to disable all buttons before completing the operation on that button.

I don't know how to disable the other two buttons. Please help.

+2


a source to share


1 answer


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

.

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

      



Note that 'clientId'

is the id of the autogenerated HTML element. Right click and view the source to find out. If it has a prefix type j_id

, etc., then you need to give all parents UINamingContainer

the components, such as <h:form>

, <h:dataTable>

, <f:subview>

, etc. with a fixed component ID so that the client ID no longer needs to be autogenerated.

+1


a source







All Articles