i have a problem with showing the right dialog!
here is a snippet of my .xhtml file:
<h:panelGroup id="global_flag_validation_failed_render">
<h:outputText id="flag_validation_failed" value="true"
rendered="#{facesContext.validationFailed}"/>
</h:panelGroup>
<h:commandButton value="Cancel"
rendered="#{!myBean.readOnly}"
onclick="return openRightOne();"
action="throwAway" immediate="true"
styleClass="button">
<f:ajax render="@form global_flag_validation_failed_render" execute="@form" onevent="openRightOne"/>
</h:commandButton>
<script type="text/javascript">
function openRightOne()
{
if(data.status === 'success'){
if($("flag_validation_failed").length === 0){
var a = RichFaces.$('dialog');
return open(a);
}else{
var a = RichFaces.$('dialog-failed');
return open(a);
}
}
}
</script>
I want to open dialog-failed
, when the validation failed and otherwise dialog
.
My problem is, when I click the button non of them gets opened and the program leaves the template.
Also I don't know for sure if the JS is executed after the validation!