Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-14178

validator: @onbeforesubmit cannot be used with MyFaces

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.5.3, 4.5.10
    • Fix Version/s: 4.5.11
    • Component/s: None
    • Labels:
    • Environment:

      Tried with:
      Tomcat 8, Metamer 4.5.11-SNAPSHOT with MyFaces
      Firefox 40

    • Steps to Reproduce:
      Hide

      Can be reproduced in Metamer.

      1. deploy Metamer with MyFaces to Tomcat and open http://127.0.0.1:8080/metamer/faces/components/richValidator/csv.xhtml
      2. write e.g. 'a' in the Decimal, from 2.5 to 9.688 input
        • expected: an ajax request is send, validation will fail with decimalMinMax: 'a' must be a signed decimal number consisting of zero or more digits
        • have: no request + JavaScript error

      When you delete the attribute onbeforesubmit from the facelet, it will work as expected.

      Show
      Can be reproduced in Metamer. deploy Metamer with MyFaces to Tomcat and open http://127.0.0.1:8080/metamer/faces/components/richValidator/csv.xhtml write e.g. 'a' in the Decimal, from 2.5 to 9.688 input expected: an ajax request is send, validation will fail with decimalMinMax: 'a' must be a signed decimal number consisting of zero or more digits have: no request + JavaScript error When you delete the attribute onbeforesubmit from the facelet, it will work as expected.

      Description

      When is the @onbeforesubmit attribute used (even with an empty value) with MyFaces you get an error in the browser's console when trying to validate an input, just before sending an ajax request (before submit), so the validation on the server side will not occur.

      Error in console:

      Error: jsf.util.chain: source cannot be a string
      	...ar G=this._Lang;var E=function(K){throw Error("jsf.util.chain: "+G.getMessage(K)...
                                                      ---^
      jsf.js?...x.faces (line 1, col 110411)
      

      The generated validation functions attached to the inputs:

      • MyFaces
        • without @onbeforesubmit :
          function(event,id,e,da){if(!da){(function(event,id){RichFaces.ajax(id,event,{"parameters":{"javax.faces.behavior.event":"valueChange"} } )}).call(e,event,id);}}
          
        • with @onbeforesubmit :
          function(event,id,e,da){if(!da){(function(event,id){jsf.util.chain(this,event,"alert('hello')","RichFaces.ajax(\"form:digits\",event,{\"parameters\":{\"javax.faces.behavior.event\":\"valueChange\"} } )")}).call(e,event,id);}}
          
      • Mojarra:
        • without @onbeforesubmit :
          function(event,id,e,da){if(!da){(function(event,id){RichFaces.ajax(this,event,{"sourceId":this,"parameters":{"javax.faces.behavior.event":"valueChange","org.richfaces.ajax.component":id} } )}).call(e,event,id);}}
          
        • with @onbeforesubmit :
          function(event,id,e,da){if(!da){(function(event,id){jsf.util.chain(this,event,"alert('hello')","RichFaces.ajax(this,event,{\"sourceId\":this,\"parameters\":{\"javax.faces.behavior.event\":\"valueChange\",\"org.richfaces.ajax.component\":\"form:digits\"} } )")}).call(e,event,id);}}
          

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                michpetrov Michal Petrov
                Reporter:
                jstefek Jiří Štefek
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: