Reputation: 1022
I try to control primefaces display show and hide from java script on bean validation failure, but its not working. As suggested in forums have tried with widgetVar name of the component in javascript and even tried with id of the component but failed.
XHTML
<p:dialog header="Modal Dialog" id="mglasspaneid" showHeader="false" closable="true" resizable="false" draggable="false" widgetVar="mglasspane" style="height: 50px !important;" modal="true">
<span id="loading" draggable="false" style="height: auto !important;">Loading</span>
</p:dialog>
Javascript
<script>
function handleComplete(data) {
if (data.status === 'success') {
console.log(document.getElementById('validation-failed').value);
mglasspane.hide();
}else{
console.log(document.getElementById('validation-failed').value);
mglasspane.show();
}
}
</script>
Upvotes: 0
Views: 9782
Reputation: 6040
From PrimeFaces 5.0 you must call any component with the PF
function (i.e. PF('widgtVar')
instead of widgetVar
which has already been deprecated in 4.0). Source here.
Replacing mglasspane.hide();
by PF('mglasspane').hide();
should work.
More information about the PF
function here
Upvotes: 2