-
Bug
-
Resolution: Duplicate
-
Major
-
None
There is an issue with stapler form validation under some specific circumstances.
See the attached sample plugin. To reproduce the issue:
1. Run the plugin with `mvn hpi:run`
2. Create a new item, select "TestItem"
3. Initial value of "Executors" is 0, even when `default` is set to 1
4. Try change the value to any positive number, move focus out of the field to trigger a validation
5. Nothing happens, validation message is still there.
I haven't been able to identify the root cause, but I've reproduced some interesting behaviours locally:
1. In the sample code, if I remove the line `<j:set var="descriptor" value="${it.descriptor}" />` then it works fine (it also works fine if the var name is set something different than `descriptor`) UPDATE: this makes it work because the backend validation is disabled with this (there isn't a descriptor by default so backend `doCheck****` is not called, so only front end validation is in place, which makes it work.
Or:
1. The sample plugin has validation for `numExecutors` on both frontend (using `class="positive-number"` and backend using a `doCheckNumExecutors` method in the descriptor). If one of the validation is removed (either front or back) then it works fine too.
BTW, this was working fine in older versions of core (2.263 at least).
- duplicates
-
JENKINS-64429 <f:number clazz="positive-number"> broken with extra FormValidation
- Closed
- is related to
-
JENKINS-64429 <f:number clazz="positive-number"> broken with extra FormValidation
- Closed
- relates to
-
JENKINS-64439 "positive-number" field validator accepts non valid java numbers
- Closed