Improve Fields to only set their value and validate if there is a matching
request parameter
--------------------------------------------------------------------------------------------
Key: CLK-722
URL: https://issues.apache.org/jira/browse/CLK-722
Project: Click
Issue Type: Improvement
Components: core
Reporter: Bob Schellink
Currently Fields set their values and validate even if there is no incoming
request parameter available. This is problematic for dynamically added fields
where a default value is set (this value gets overwritten when the Field is
processed) and the field is validated and an error message is displayed without
the user having seen this field before.
I suggest Field onProcess changed from this:
public boolean onProcess() {
bindRequestValue();
if (getValidate()) {
validate();
}
dispatchActionEvent();
...
}
to this:
public boolean onProcess() {
if (getContext().hasParameter(getName()) {
bindRequestValue();
if (getValidate()) {
validate();
}
dispatchActionEvent();
...
}
}
I can see at least three reasons why the Field value won't be present:
1. The field was dynamically added to the form in the POST request
2. The field was disabled through JS (HTML does not post a disabled field value)
3. The field is an unchecked Checkbox or Radio (HTML does not post unchecked
checkbox or radio values)
This feature is a good supplement to the dynamic Form support added in 2.2.0.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.