ICEfaces
  1. ICEfaces
  2. ICE-11132

Multiple ace:autoCompleteEntry components in same form with ace:clientValidateRequired causes premature validation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-4.1.0.GA
    • Fix Version/s: 4.2.BETA, 4.2
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      Tomcat 7/8, FF 47, IE 11, Chrome 52.
    • Assignee Priority:
      P2
    • Affects:
      Compatibility/Configuration

      Description

      Issue found when using multiple ace:autoCompleteEntry components with ace:clientValidateRequired in one form.
      Using this configuration the ace:autoCompleteEntry does not behave as expected.
      Scenario:
      A form has 3 ace:autoCompleteEntry components, each use an ace:clientValidateRequired within.
      After typing only one character into the first ace:autoCompleteEntry the validation messages for the 2nd and third autoCompleteEntry are immediately rendered.
      This can be reproduced with the /ICE-10883.jsf test app found at
      http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces4/Sparkle/Nightly/autoCompleteEntry

        Activity

        Hide
        Ken Fyten added a comment -

        Re-opened.

        We seem to be going in circles on this issue...

        Due to the inherent complexities of this component we will drop support for using the clientValidator* "validateOn" attribute with it. It will continue to function with client validators using the default submit events as it has previously.

        Show
        Ken Fyten added a comment - Re-opened. We seem to be going in circles on this issue... Due to the inherent complexities of this component we will drop support for using the clientValidator* "validateOn" attribute with it. It will continue to function with client validators using the default submit events as it has previously.
        Hide
        Mircea Toma added a comment - - edited

        Well, I gave it another shot and I believe I got it right this time. In order to make the client validation work as expected I had to enhance client validation to respect the scope of the 'execute' attribute of a partial submit.

        So, for (2) where validation is triggered by the partial submit we need to define which components are executed (client validation will now respect that):

        <ace:autoCompleteEntry id="autoCompleteEntry1" value="#{autoCompleteEntryClientVal.value1}"
                                                rows="10" label="ace:autoCompleteEntry 1" labelPosition="top">             
                         <ace:clientValidateRequired  />      
                         <ace:ajax execute="@this" render="@this messageGrid1" event="blur"/>         
                        <f:selectItems value="#{autoCompleteEntryBean.cities}"/>
        </ace:autoCompleteEntry>
        

        The event "blur" needs to be defined on the ace:ajax facet since the default behviour for required validation is to enforce it only when the form is submitted. See https://jqueryvalidation.org/required-method/ .

        Show
        Mircea Toma added a comment - - edited Well, I gave it another shot and I believe I got it right this time. In order to make the client validation work as expected I had to enhance client validation to respect the scope of the 'execute' attribute of a partial submit. So, for (2) where validation is triggered by the partial submit we need to define which components are executed (client validation will now respect that): <ace:autoCompleteEntry id= "autoCompleteEntry1" value= "#{autoCompleteEntryClientVal.value1}" rows= "10" label= "ace:autoCompleteEntry 1" labelPosition= "top" > <ace:clientValidateRequired /> <ace:ajax execute= "@ this " render= "@ this messageGrid1" event= "blur" /> <f:selectItems value= "#{autoCompleteEntryBean.cities}" /> </ace:autoCompleteEntry> The event "blur" needs to be defined on the ace:ajax facet since the default behviour for required validation is to enforce it only when the form is submitted. See https://jqueryvalidation.org/required-method/ .
        Hide
        Mircea Toma added a comment - - edited

        Liana said:
        "I made a new test app /autoCompleteEntryClientValidateRequired2.jsf found at: http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces4/Sparkle/Nightly/autoCompleteEntry
        Here there are 3 autoCompleteEntries in a form, set up as suggested in your last comment in ICE-11132.

        <ace:autoCompleteEntry id="autoCompleteEntry1" value="#{autoCompleteEntryClientVal.value1}"
                                                rows="10" label="ace:autoCompleteEntry 1" labelPosition="top">             
                         <ace:clientValidateRequired  />      
                         <ace:ajax execute="@this" render="@this messageGrid1" event="blur"/>         
                        <f:selectItems value="#{autoCompleteEntryBean.cities}"/>
        </ace:autoCompleteEntry>
        

        The first autoCompleteEntry validates as expected but the other two do not. No messages are shown for autoCompleteEntries 2 and 3 unless a submit via submit button is performed."

        Show
        Mircea Toma added a comment - - edited Liana said: "I made a new test app /autoCompleteEntryClientValidateRequired2.jsf found at: http://dev.icesoft.com/svn/repo/qa/trunk/Regression-Icefaces4/Sparkle/Nightly/autoCompleteEntry Here there are 3 autoCompleteEntries in a form, set up as suggested in your last comment in ICE-11132 . <ace:autoCompleteEntry id= "autoCompleteEntry1" value= "#{autoCompleteEntryClientVal.value1}" rows= "10" label= "ace:autoCompleteEntry 1" labelPosition= "top" > <ace:clientValidateRequired /> <ace:ajax execute= "@ this " render= "@ this messageGrid1" event= "blur" /> <f:selectItems value= "#{autoCompleteEntryBean.cities}" /> </ace:autoCompleteEntry> The first autoCompleteEntry validates as expected but the other two do not. No messages are shown for autoCompleteEntries 2 and 3 unless a submit via submit button is performed."
        Hide
        Mircea Toma added a comment -

        Fixed disableRules function to return the disabled rules for the current submit (as it's expected from it).

        Show
        Mircea Toma added a comment - Fixed disableRules function to return the disabled rules for the current submit (as it's expected from it).
        Hide
        Liana Munroe added a comment -

        Verified ICEfaces 4 trunk r49391, Tomcat 7, FF 47, Chrome 53, MS Edge, IE 11, 10, 9, 8.

        Show
        Liana Munroe added a comment - Verified ICEfaces 4 trunk r49391, Tomcat 7, FF 47, Chrome 53, MS Edge, IE 11, 10, 9, 8.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Liana Munroe
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: