Immediately process update HtmlInputHidden values during conversion/validation phase
- Dominant language
- Java
- Stars
- 127
- Forks
- 59
- Avg merge
- 23h
- Merged PRs (30d)
- 7
Description
Requested by use balusc
([https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=765):](https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=765):)
Imagine a request scoped bean with a h:inputHidden field and another UIInput
field which is to be converted and/or validated. If the h:inputHidden already
has a value but the conversion and/or validation of the another UIInput field
fails, then the value of the h:inputHidden will get lost.
Truly, this is behaviour by specification, but it is not very intuitive. One
would expect that hidden input values (read: the values which aren't to be
filled in by the client, but by the server) should retain its value. In real
world web applications the sole purpose of hidden input elements is to transfer
values from request to request without any client interaction.
Thus, hereby my request for an enhancement in the API: make sure that the API
retains hidden input values regardless of the global outcome of the
conversion/validation phase. And only if the hidden input value itself is
already successfully converted and validated.
In theory this can simply be achieved by adding the following lines at the
bottom of the if (isValid()) {} block which starts at line 887 of
javax.faces.component.UIInput in 2.0.0 EDR1:
if (this instanceof HtmlInputHidden) {
processUpdates(context);
}
If necessary you can also let it implement a certain marker interface, e.g.
RetainableValueHolder or so (I just say something) so that one can decide to let
some custom component implement it.
I am almost sure that this will be greatly appreciated by the web development
world. It is certainly much more intuitive. And it is much more elegant than the
'workaround' to bind the h:inputHidden and using the UIInput#getValue() /
setValue() instead.
#### Environment
Operating System: All
Platform: All
#### Affected Versions
[2.0]
Contributor guide
Research direction
Start in javax.faces.component.UIInput at the process-updates logic described around line 887 in the 2.0.0 EDR1 source, and review how HtmlInputHidden participates in conversion and validation. Determine the API or marker-interface approach that fits the lifecycle, then verify that a valid hidden value is retained when another UIInput fails while an invalid hidden value is not retained.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100