0

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!

ADyson
  • 57,178
  • 14
  • 51
  • 63
glove40
  • 45
  • 6
  • 1
    "I don't know for sure if the JS is executed after the validation!" In that case open your browser's development tools and set a breakpoint – ADyson Oct 24 '17 at 09:14
  • https://stackoverflow.com/questions/15349979/jsf-validation-failed-javascript-callback – Kukeltje Oct 24 '17 at 09:47

0 Answers0