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

Form validation not working with different "level/layer" of fields

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core

      When you have a field in a form, that is coming from a different level/layer than another one, you cannot "combine" them for form validation.

      The first call to the checkMethod will be done correctly, but then, the second will lack the second value.

      This is due to the 2 following behavior in hudson-behavior.js:

      The first one will register the validator we want, and trigger a first call. This is working fine. But then, the second rule will put the nameref attribute, which limit the boundaries of the level/layer of the form.

      This is impacting the validation when you have a f:hetero-radio. For example, look at credentials-plugin, version 2.3.x, in CertificateCredentialsImpl/credentials.jelly. The password and the hidden file input are on two different levels, and try to communicate together. The first call include the password and thus the validation message is OK, but the second call (due to the radio entry once loaded is triggering "applySubtree" and so, triggering the validation) is lacking the password and thus failing the validation with a warning.

          [JENKINS-65616] Form validation not working with different "level/layer" of fields

          James Nord added a comment - - edited

          interestingly I have something using FormValidation with a @RealativePath(..) that will that not send the entry on the first call but is present on subsequent calls :-o

          it only seems to ever work if the element that is matched with the RelativePath also has an individual check, perhaps this is the issue?

          Jenkins 2.426.3 FWIW

          James Nord added a comment - - edited interestingly I have something using FormValidation with a @RealativePath(..) that will that not send the entry on the first call but is present on subsequent calls :-o it only seems to ever work if the element that is matched with the RelativePath also has an individual check, perhaps this is the issue? Jenkins 2.426.3 FWIW

          Jesse Glick added a comment -

          The title is misleading since form validation is not “expected” to work across multiple levels. It never has, and would need a lot of work to support that. Nor can you load structured objects. You just cannot implement any form validation features that take into account anything other than text & primitives in the current Describable.

          Jesse Glick added a comment - The title is misleading since form validation is not “expected” to work across multiple levels. It never has, and would need a lot of work to support that. Nor can you load structured objects. You just cannot implement any form validation features that take into account anything other than text & primitives in the current Describable .

          James Nord added a comment - - edited

          > The title is misleading since form validation is not “expected” to work across multiple levels.

          official docs state  otherwise

          And whilst this ties a Describable to a specific implementation of the parent that contains it (parents may have different form fields etc) which generically would be bad form, there are some instances where the describable is very much tied to its parent and not expected to be used outside of it.

          James Nord added a comment - - edited > The title is misleading since form validation is not “expected” to work across multiple levels. official docs state  otherwise And whilst this ties a Describable to a specific implementation of the parent that contains it (parents may have different form fields etc) which generically would be bad form, there are some instances where the describable is very much tied to its parent and not expected to be used outside of it.

            Unassigned Unassigned
            wfollonier Wadeck Follonier
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: