You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "Bob Schellink (JIRA)" <ji...@apache.org> on 2010/10/26 04:51:19 UTC

[jira] Created: (CLK-722) Improve Fields to only set their value and validate if there is a matching request parameter

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.


[jira] Resolved: (CLK-722) Improve Fields to only set their value and validate if there is a matching request parameter

Posted by "Bob Schellink (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLK-722?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bob Schellink resolved CLK-722.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3.0-M1
         Assignee: Bob Schellink

done

> 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
>            Assignee: Bob Schellink
>             Fix For: 2.3.0-M1
>
>
> 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.