Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64429

<f:number clazz="positive-number"> broken with extra FormValidation

    • 2.277

      if your Jelly uses

       <f:number clazz="positive-number" min="1" step="1" default="1"/>
      

      and also has a doCheck method then an initial failure validation is never cleared.

      to reproduce, unpack the provided test project and build it. (this will use a jenkins version prior to table to div)
      start the plugin with `mvn hpi:run` and go to the http://localhost:8080/jenkins/configure page.
      Observe that there is a validation error for the "My Field" in "JENKINS-64429" section.
      Change the value so that it is valid (to 1) and tab out of the field
      Observe that the validation error clears.

      stop the Jenkins process.
      clean the work and target (rm -fr work/ target/)
      build with a newer version of jenkins core (mvn hpi:run -Djenkins.version=2.270) and go to the http://localhost:8080/jenkins/configure page.
      Observe that there is a validation error for the "My Field" in "JENKINS-64429" section.
      Change the value so that it is valid (to 1) and tab out of the field
      Observe that the validation warning does not disappear

          [JENKINS-64429] <f:number clazz="positive-number"> broken with extra FormValidation

          timja I'm positive this has to do with a conflict between registerValidator and registerRegexpValidatorregisterValidator does not properly look for the validation-error-area (https://github.com/jenkinsci/jenkins/blob/53f300d5ec07eb5efa3774d3f12455615d2f3450/war/src/main/webapp/scripts/hudson-behavior.js#L509) and it causes it to break for registerRegexpValidator (https://github.com/jenkinsci/jenkins/blob/53f300d5ec07eb5efa3774d3f12455615d2f3450/war/src/main/webapp/scripts/hudson-behavior.js#L576)

          Félix Queiruga Balado added a comment - timja  I'm positive this has to do with a conflict between  registerValidator and  registerRegexpValidator .  registerValidator  does not properly look for the validation-error-area ( https://github.com/jenkinsci/jenkins/blob/53f300d5ec07eb5efa3774d3f12455615d2f3450/war/src/main/webapp/scripts/hudson-behavior.js#L509)  and it causes it to break for  registerRegexpValidator ( https://github.com/jenkinsci/jenkins/blob/53f300d5ec07eb5efa3774d3f12455615d2f3450/war/src/main/webapp/scripts/hudson-behavior.js#L576 )

          This looks like a specific case of JENKINS-64651 - the same issue affects other validations (`clazz="required"` for example).

          Antonio Muñiz added a comment - This looks like a specific case of JENKINS-64651 - the same issue affects other validations (`clazz="required"` for example).

          I have created a PR to fix this issue on https://github.com/jenkinsci/jenkins/pull/5195.

          Félix Queiruga Balado added a comment - I have created a PR to fix this issue on https://github.com/jenkinsci/jenkins/pull/5195 .

            fqueiruga Félix Queiruga Balado
            teilo James Nord
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: