You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "Malcolm Edgar (JIRA)" <ji...@apache.org> on 2010/03/13 12:30:27 UTC

[jira] Created: (CLK-643) Form copy to object behaviour

Form copy to object behaviour
-----------------------------

                 Key: CLK-643
                 URL: https://issues.apache.org/jira/browse/CLK-643
             Project: Click
          Issue Type: Improvement
          Components: core
    Affects Versions: 2.1.0
            Reporter: Malcolm Edgar
            Priority: Minor


The Form#copyFormToObject() behaviour can be misleading in two respects.

When a HTML forms field is disabled, its value is displayed in the browser window but it is not editable and is disable. However when the user submits the form the field value is not submitted even if it is populated. The Form#copyFormToObject() method will actually nullify the target objects property value, as the disabled field has a null value.  This is clearly not the expected behaviour.

The other scenario which is problematic is with readonly fields. By default the Form#copyFormToObject() method will write read only field value into the target objects properties. Sometimes this is not the behaviour you are after, as type coercion behaviour cause errors. For example if you are using a form which has some TextFields showin a date property as a readonly field, when the form is submitted the string value will be set on the target objects property which will cause type coercion issues, or may truncate data. The Form should have an option to not write readonly field values when copying form field values to a target object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CLK-643) Form copy to object behaviour

Posted by "Malcolm Edgar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845039#action_12845039 ] 

Malcolm Edgar commented on CLK-643:
-----------------------------------

Yeah that is a good point. I think we should probably preserve the existing, but unintuitive behaviour.

I think the Form object should have some additional properties which can be set to modify the default copyToObject behaviour:

protected boolean noCopyFromDisabledFields;

protected boolean noCopyFromReadonlyFields;

These values would be inspected by the ContailerUtils methods to determine whether field values should be copied.



> Form copy to object behaviour
> -----------------------------
>
>                 Key: CLK-643
>                 URL: https://issues.apache.org/jira/browse/CLK-643
>             Project: Click
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 2.1.0
>            Reporter: Malcolm Edgar
>            Assignee: Malcolm Edgar
>            Priority: Minor
>             Fix For: 2.2.0
>
>
> The Form#copyFormToObject() behaviour can be misleading in two respects.
> When a HTML forms field is disabled, its value is displayed in the browser window but it is not editable and is disable. However when the user submits the form the field value is not submitted even if it is populated. The Form#copyFormToObject() method will actually nullify the target objects property value, as the disabled field has a null value.  This is clearly not the expected behaviour.
> The other scenario which is problematic is with readonly fields. By default the Form#copyFormToObject() method will write read only field value into the target objects properties. Sometimes this is not the behaviour you are after, as type coercion behaviour cause errors. For example if you are using a form which has some TextFields showin a date property as a readonly field, when the form is submitted the string value will be set on the target objects property which will cause type coercion issues, or may truncate data. The Form should have an option to not write readonly field values when copying form field values to a target object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CLK-643) Form copy to object behaviour

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

Malcolm Edgar reassigned CLK-643:
---------------------------------

    Assignee: Malcolm Edgar

> Form copy to object behaviour
> -----------------------------
>
>                 Key: CLK-643
>                 URL: https://issues.apache.org/jira/browse/CLK-643
>             Project: Click
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 2.1.0
>            Reporter: Malcolm Edgar
>            Assignee: Malcolm Edgar
>            Priority: Minor
>
> The Form#copyFormToObject() behaviour can be misleading in two respects.
> When a HTML forms field is disabled, its value is displayed in the browser window but it is not editable and is disable. However when the user submits the form the field value is not submitted even if it is populated. The Form#copyFormToObject() method will actually nullify the target objects property value, as the disabled field has a null value.  This is clearly not the expected behaviour.
> The other scenario which is problematic is with readonly fields. By default the Form#copyFormToObject() method will write read only field value into the target objects properties. Sometimes this is not the behaviour you are after, as type coercion behaviour cause errors. For example if you are using a form which has some TextFields showin a date property as a readonly field, when the form is submitted the string value will be set on the target objects property which will cause type coercion issues, or may truncate data. The Form should have an option to not write readonly field values when copying form field values to a target object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CLK-643) Form copy to object behaviour

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

Bob Schellink updated CLK-643:
------------------------------

    Fix Version/s:     (was: 2.2.0)
                   2.3.0

> Form copy to object behaviour
> -----------------------------
>
>                 Key: CLK-643
>                 URL: https://issues.apache.org/jira/browse/CLK-643
>             Project: Click
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 2.1.0
>            Reporter: Malcolm Edgar
>            Assignee: Malcolm Edgar
>            Priority: Minor
>             Fix For: 2.3.0
>
>
> The Form#copyFormToObject() behaviour can be misleading in two respects.
> When a HTML forms field is disabled, its value is displayed in the browser window but it is not editable and is disable. However when the user submits the form the field value is not submitted even if it is populated. The Form#copyFormToObject() method will actually nullify the target objects property value, as the disabled field has a null value.  This is clearly not the expected behaviour.
> The other scenario which is problematic is with readonly fields. By default the Form#copyFormToObject() method will write read only field value into the target objects properties. Sometimes this is not the behaviour you are after, as type coercion behaviour cause errors. For example if you are using a form which has some TextFields showin a date property as a readonly field, when the form is submitted the string value will be set on the target objects property which will cause type coercion issues, or may truncate data. The Form should have an option to not write readonly field values when copying form field values to a target object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (CLK-643) Form copy to object behaviour

Posted by co...@gmail.com.
Just from my own intuitive angle, I would expect the form to only copy 
fields which were submitted regardless of disabled or readonly flag.

Main reason being that these are interface attributes which can be 
turned on/off on the client side (via javascript).

i.e you can setReadonly/setDisabled in java program but some javascript 
might turn them back on.

Regards,

Huy


Bob Schellink (JIRA) wrote:
>     [ https://issues.apache.org/jira/browse/CLK-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845044#action_12845044 ] 
>
> Bob Schellink commented on CLK-643:
> -----------------------------------
>
> Having Form properties to override defaults could be useful, but an intuitive default will be good.
>
> According to the spec, the disabled attribute was meant to be used in the context of JavaScript, so catering for this use case make sense. I have a feeling that disabled usage is underutilized because of its strange behavior.
>
>   
>> Form copy to object behaviour
>> -----------------------------
>>
>>                 Key: CLK-643
>>                 URL: https://issues.apache.org/jira/browse/CLK-643
>>             Project: Click
>>          Issue Type: Improvement
>>          Components: core
>>    Affects Versions: 2.1.0
>>            Reporter: Malcolm Edgar
>>            Assignee: Malcolm Edgar
>>            Priority: Minor
>>             Fix For: 2.2.0
>>
>>
>> The Form#copyFormToObject() behaviour can be misleading in two respects.
>> When a HTML forms field is disabled, its value is displayed in the browser window but it is not editable and is disable. However when the user submits the form the field value is not submitted even if it is populated. The Form#copyFormToObject() method will actually nullify the target objects property value, as the disabled field has a null value.  This is clearly not the expected behaviour.
>> The other scenario which is problematic is with readonly fields. By default the Form#copyFormToObject() method will write read only field value into the target objects properties. Sometimes this is not the behaviour you are after, as type coercion behaviour cause errors. For example if you are using a form which has some TextFields showin a date property as a readonly field, when the form is submitted the string value will be set on the target objects property which will cause type coercion issues, or may truncate data. The Form should have an option to not write readonly field values when copying form field values to a target object.
>>     
>
>   

[jira] Commented: (CLK-643) Form copy to object behaviour

Posted by "Bob Schellink (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845044#action_12845044 ] 

Bob Schellink commented on CLK-643:
-----------------------------------

Having Form properties to override defaults could be useful, but an intuitive default will be good.

According to the spec, the disabled attribute was meant to be used in the context of JavaScript, so catering for this use case make sense. I have a feeling that disabled usage is underutilized because of its strange behavior.

> Form copy to object behaviour
> -----------------------------
>
>                 Key: CLK-643
>                 URL: https://issues.apache.org/jira/browse/CLK-643
>             Project: Click
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 2.1.0
>            Reporter: Malcolm Edgar
>            Assignee: Malcolm Edgar
>            Priority: Minor
>             Fix For: 2.2.0
>
>
> The Form#copyFormToObject() behaviour can be misleading in two respects.
> When a HTML forms field is disabled, its value is displayed in the browser window but it is not editable and is disable. However when the user submits the form the field value is not submitted even if it is populated. The Form#copyFormToObject() method will actually nullify the target objects property value, as the disabled field has a null value.  This is clearly not the expected behaviour.
> The other scenario which is problematic is with readonly fields. By default the Form#copyFormToObject() method will write read only field value into the target objects properties. Sometimes this is not the behaviour you are after, as type coercion behaviour cause errors. For example if you are using a form which has some TextFields showin a date property as a readonly field, when the form is submitted the string value will be set on the target objects property which will cause type coercion issues, or may truncate data. The Form should have an option to not write readonly field values when copying form field values to a target object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CLK-643) Form copy to object behaviour

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

Bob Schellink updated CLK-643:
------------------------------

    Fix Version/s: 2.2.0

Hi Malcolm,

One aspect we need to think about around the disabled attribute, is it is often used to display an initial value in a disabled state, but using JavaScript it can be enabled upon certain conditions. For example, one can display a disabled FieldSet and if the "I Agree" checkbox is checked, the FieldSet is enabled.

If we do not copy the disabled field value to the target object, this scenario won't work.

One solution for this could be as follows: in the Field onProcess method we check if there is an incoming request parameter. If there is, we switch off the disabled property and process the Field normally. If there is not and incoming request parameter, we skip the onProcess step.


> Form copy to object behaviour
> -----------------------------
>
>                 Key: CLK-643
>                 URL: https://issues.apache.org/jira/browse/CLK-643
>             Project: Click
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 2.1.0
>            Reporter: Malcolm Edgar
>            Assignee: Malcolm Edgar
>            Priority: Minor
>             Fix For: 2.2.0
>
>
> The Form#copyFormToObject() behaviour can be misleading in two respects.
> When a HTML forms field is disabled, its value is displayed in the browser window but it is not editable and is disable. However when the user submits the form the field value is not submitted even if it is populated. The Form#copyFormToObject() method will actually nullify the target objects property value, as the disabled field has a null value.  This is clearly not the expected behaviour.
> The other scenario which is problematic is with readonly fields. By default the Form#copyFormToObject() method will write read only field value into the target objects properties. Sometimes this is not the behaviour you are after, as type coercion behaviour cause errors. For example if you are using a form which has some TextFields showin a date property as a readonly field, when the form is submitted the string value will be set on the target objects property which will cause type coercion issues, or may truncate data. The Form should have an option to not write readonly field values when copying form field values to a target object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CLK-643) Form copy to object behaviour

Posted by "Bob Schellink (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLK-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846325#action_12846325 ] 

Bob Schellink commented on CLK-643:
-----------------------------------

Would one really need both properties? Perhaps a noCopy property is enough? A related issue is about having immutable controls so that once the value is set, it cannot be altered. I normally create an ImmutableHiddenField for this purpose, but might be useful for other fields as well.

> Form copy to object behaviour
> -----------------------------
>
>                 Key: CLK-643
>                 URL: https://issues.apache.org/jira/browse/CLK-643
>             Project: Click
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 2.1.0
>            Reporter: Malcolm Edgar
>            Assignee: Malcolm Edgar
>            Priority: Minor
>             Fix For: 2.2.0
>
>
> The Form#copyFormToObject() behaviour can be misleading in two respects.
> When a HTML forms field is disabled, its value is displayed in the browser window but it is not editable and is disable. However when the user submits the form the field value is not submitted even if it is populated. The Form#copyFormToObject() method will actually nullify the target objects property value, as the disabled field has a null value.  This is clearly not the expected behaviour.
> The other scenario which is problematic is with readonly fields. By default the Form#copyFormToObject() method will write read only field value into the target objects properties. Sometimes this is not the behaviour you are after, as type coercion behaviour cause errors. For example if you are using a form which has some TextFields showin a date property as a readonly field, when the form is submitted the string value will be set on the target objects property which will cause type coercion issues, or may truncate data. The Form should have an option to not write readonly field values when copying form field values to a target object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.