You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Kevin Menard (JIRA)" <de...@tapestry.apache.org> on 2008/01/24 22:38:35 UTC

[jira] Created: (TAPESTRY-2085) Empty textfield submits null value

Empty textfield submits null value
----------------------------------

                 Key: TAPESTRY-2085
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
             Project: Tapestry
          Issue Type: Bug
    Affects Versions: 5.0.10
            Reporter: Kevin Menard
            Priority: Critical


This was initially reported on the dev list by Geoff Callender.

When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.

The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2085) Empty textfield submits null value

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564976#action_12564976 ] 

Howard M. Lewis Ship commented on TAPESTRY-2085:
------------------------------------------------

One problem with the examples from the mailing list is the encoding of a blank string into the URL; this shows up as two adjacent slashes and that's just asking for trouble.  This will not be allowed.

> Empty textfield submits null value
> ----------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Assignee: Howard M. Lewis Ship
>            Priority: Critical
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2085) Empty textfield submits null value

Posted by "Vjeran Marcinko (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562913#action_12562913 ] 

Vjeran Marcinko commented on TAPESTRY-2085:
-------------------------------------------

Ah, sorry for complaint... It seems I missed the point :-(

I understand that some things that worked before don't work anymore, and they should definetly be resolved somehow, and that's the issue here. Thing is that I am afraid that issues will be resolved in a way that would lead to just setting empty string values to bound property like it was before, and I think a lot of users would not prefer that way. If I remember correctly, T3 has been setting empty values and T4 has been doing it with null values. I had definetly prefered the later.

> Empty textfield submits null value
> ----------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Priority: Critical
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2085) Empty textfield submits null value

Posted by "Kevin Menard (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562900#action_12562900 ] 

Kevin Menard commented on TAPESTRY-2085:
----------------------------------------

I'm not really sure what point you're arguing.  The core of the matter is things that used to work no longer do and there's no trivial way to get around that.

As for null versus empty . . . I guess it's a matter of taste, but the value POST'd is not null.  There's a translation going on there and it's not symmetric.

I guess at the very least, the expectation is that you're given a value.  I think this is consistent with nearly all other Web frameworks in all other languages.  Of course, I haven't tried them all, but I'm drawing from the experience I've had with a decent number of others.  Call it an application of the Null Object pattern if you may.

Anyway, it sounds like Howard has a decent idea of how this ought to be addressed, although, based on the varying opinions of correct behavior, it likely isn't going to be a fun one.

> Empty textfield submits null value
> ----------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Priority: Critical
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2085) Empty textfield submits null value

Posted by "Geoff Callender (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562421#action_12562421 ] 

Geoff Callender commented on TAPESTRY-2085:
-------------------------------------------

>From the mailing list, Howard laid out some thoughts and a workaround:

The difference is that blank fields used to show up as the empty
string and are now showing up in the properties as null.

This could be addressed by a different NullFieldStrategy.  Perhaps
Tapestry should detect that the field is of type String and use
NullFieldStrategy that converts blank fields to the empty string.

In any case, a workaround is:

Object onSuccess() {

   if (_firstName == null) _firstName = "";
   if (_lastName == null) _lastName = "";

		_nextPage.onActivate(_firstName, _lastName);
		return _nextPage;
}




> Empty textfield submits null value
> ----------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Priority: Critical
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Closed: (TAPESTRY-2085) When a user submit a form with a TextField and the value is missing or blank, the value null is passed through the component to the model property

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAPESTRY-2085.
------------------------------------------

       Resolution: Fixed
    Fix Version/s: 5.0.10

I think this is finally nailed.

> When a user submit a form with a TextField and the value is missing or blank, the value null is passed through the component to the model property
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Assignee: Howard M. Lewis Ship
>            Priority: Critical
>             Fix For: 5.0.10
>
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-2085) When a user submit a form with a TextField and the value is missing or blank, the value null is passed through the component to the model property

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship updated TAPESTRY-2085:
-------------------------------------------

    Summary: When a user submit a form with a TextField and the value is missing or blank, the value null is passed through the component to the model property  (was: Empty textfield submits null value)

> When a user submit a form with a TextField and the value is missing or blank, the value null is passed through the component to the model property
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Assignee: Howard M. Lewis Ship
>            Priority: Critical
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2085) Empty textfield submits null value

Posted by "Vjeran Marcinko (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562884#action_12562884 ] 

Vjeran Marcinko commented on TAPESTRY-2085:
-------------------------------------------

Value 0 for Integer and value "" for String is still A VALUE, and that is different for something having NO VALUE. Java language normally uses "null" for this purpose. Same as I want in database to have column with SQL value NULL when it is not set. Unfortunately, primitives cannot be used that way so some value has to be picked to represent no-value. 
Of course, you always have to have additional check with value != null in the code before using value, but I consider that to be normal.

My thought is that it would be best for TextFields and TextArea to have optional parameter flag that would return empty string instead of null if this parameter is set.


> Empty textfield submits null value
> ----------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Priority: Critical
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2085) When a user submit a form with a TextField and the value is missing or blank, the value null is passed through the component to the model property

Posted by "Joel Wiegman (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566145#action_12566145 ] 

Joel Wiegman commented on TAPESTRY-2085:
----------------------------------------

FWIW, using 5.0.10 I have a TextField bound to a java.lang.Integer and I can't get it to pass validation (my only validation requirement on the field is t:validate="maxlength=2").  

I get the validation error: "The input value '' is not parseable as an integer value."

I'm using the DefaultNullStrategy (because I want it to be null if an empty TextField is submitted).  When I add nulls="zero" to the TextField I have a different problem:

Render queue error in BeginRender[app/controllist/consignment/EditControl:departmentid]: java.lang.Long cannot be cast to java.lang.Integer

> When a user submit a form with a TextField and the value is missing or blank, the value null is passed through the component to the model property
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Assignee: Howard M. Lewis Ship
>            Priority: Critical
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Assigned: (TAPESTRY-2085) Empty textfield submits null value

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship reassigned TAPESTRY-2085:
----------------------------------------------

    Assignee: Howard M. Lewis Ship

> Empty textfield submits null value
> ----------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Assignee: Howard M. Lewis Ship
>            Priority: Critical
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2085) Empty textfield submits null value

Posted by "Geoff Callender (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562423#action_12562423 ] 

Geoff Callender commented on TAPESTRY-2085:
-------------------------------------------

In case this affects the choice of solution, note that the workaround created new problems for the next page, called basicinput2...

The URL it created for the next oage is
	http://localhost:8180/jumpstart/examples/input/basicinput2//
instead of
	http://localhost:8180/jumpstart/examples/input/basicinput2/null/null

The side effects are:

1. The PageLinks on the page are no longer resolvable. eg.
	<a t:type="pagelink" t:page="Start" href="#">To Start</a>
is interpreted as
	http://localhost:8180/jumpstart/examples/input/start
instead of
	http://localhost:8180/jumpstart/start

2. The default stylesheet isn't loaded, presumable because its URL is generated incorrectly.



> Empty textfield submits null value
> ----------------------------------
>
>                 Key: TAPESTRY-2085
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2085
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 5.0.10
>            Reporter: Kevin Menard
>            Priority: Critical
>
> This was initially reported on the dev list by Geoff Callender.
> When submitting a form containing a textfield and nothing has been typed into that textfield, the value will be submitted as null rather than the empty string.  In past version, the empty string would be submitted.
> The net result is NPEs and coercion issues.  If the textfield is bound to a String and that String is used without checking for null, an NPE will result when none used to.  If the textfield is bound to any other type, such as an Integer, the Tapestry type coercer will fail with an appropriate exception (e.g., NumberFormatException).

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org