How to disable onClick components of a button in JSF?
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.
a source to share