Reputation: 1588
I want to change the Label of a h:commandLink during AJAX call.
<h:commandLink id="submitlink" class="link" value="submit" action="#{mailhandler.testValues}" >
<f:ajax render="@form" execute="@form" onevent="handleDisableButton"/>
</h:commandLink>
JavaScript:
function handleDisableButton(data) {
document.getElementById("form:submitlink").disabled = (data.status != "success");
}
I found examples how to do this using Button but in this case I don't know how to implements is for h:commandLink.
Upvotes: 0
Views: 176
Reputation: 1483
If you want the label to be changed only during the Ajax call:
function handleDisableButton(data) {
data.source.text = 'processing...';
}
The initial label will be restored on form update. If you want it to be permanently changed, bind its value to a backing bean parameter and change it in the action method.
Upvotes: 1