1
votes
<p:commandButton id .......
onclick=”disableButton(this);”
onkeypress=”disableButton(this);”
oncomplete="enableButton('${bean.enableButton()}');"

private boolean enableButton(){
  return false;
}

<script>
function disableButton(data) {
  data.disable = true;
}

function enableButton(data) {
  data.disable = data;
}
</script>

Observed both calls working in the debugger, but the button remains disabled When disableButton is called data = button#MessageView j_idt183:…. When enableButton is called data = {url: “ ……….} from the debugger

1
Does this answer your question? How to do double-click prevention in JSF - Jasper de Vries
Jasper, thanks for reviewing my question, unfortunately your suggestion was tried prior to my submission. - Steve
What do you mean with "your suggestion". The linked question has several answers. None of them worked for you? I find that hard to believe. - Jasper de Vries
"Does this answer your question? How to do double-click prevention in JSF". I've tried numerous solutions. - Steve

1 Answers

1
votes
<p:commandButton id .......
   onclick=”disableButton(this);”
   onkeypress=”disableButton(this);”
   oncomplete="enableButton();"
<script>

function disableButton(data) {
  data.disable = true;
  window.buttonPressed.disabled = data
}
// Save and use the initial "data" object 
function enableButton() {
   window.buttonPressed.disabled = false;
}