You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Geoff Callender <ge...@gmail.com> on 2007/12/10 11:35:19 UTC
T5: Client persistence bug? User typing lost.
Hi,
Is this a bug? I couldn't find it in JIRA. The user loses the
changes they typed into an "input" or "edit" page if an error is
recorded by onSuccess() AND the page is dealing with a client
persisted object. The page is redisplayed OK, with error, but with
the previous values!!!
The user's changes aren't lost if
(a) I move the work that finds the error from onSuccess() into
onValidate(); or
(b) I add a simple client-persisted field to the page; or
(c) I replace client persistence with session persistence.
To illustrate the problem, it's just like the example from http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html
, which contains these excerpts:
@Persist
private String _userName;
private String _password;
String onSuccess()
{
if (!_authenticator.isValid(_userName, _password))
{
_form.recordError(_passwordField, "Invalid user name or
password.");
return null;
}
return "PostLogin";
}
except that instead of a single field, _userName, I am persisting a
whole object, _user:
@Persist("client")
private User _user;
and in the template we refer to its fields, eg:
<input t:type="TextField" t:id="firstName" value="user.firstName" ...
If the user types a value into firstName, but the onSuccess() method
records an error, then the user loses what they typed.
However, if I add another field to the page then everything works!
@Persist("client")
private String _aField;
<input t:type="TextField" t:id="aField" value="aField" ...
Alternatively, it works if I do either of the other 2 things - use
session persistence or move all logic into onValidate().
Anyone else seen this?
Thanks,
Geoff
Re: T5: Client persistence bug? User typing lost.
Posted by Geoff Callender <ge...@gmail.com>.
Done. https://issues.apache.org/jira/browse/TAPESTRY-1972
Thanks for the assistance.
Geoff
On 11/12/2007, at 7:04 AM, Filip S. Adamsen wrote:
> Looked at it, still looks like a bug.
>
> I'd add it to JIRA, but you know exactly what's wrong. ;)
>
> -Filip
>
> Filip S. Adamsen skrev:
>> I would definitely add a JIRA issue then, that sounds very
>> suspicious.
>> Oh, and maybe try the latest 5.0.7 snapshot if you can, but I don't
>> think that'll help. In any case I'll look at it when I get home
>> later today.
>> -Filip
>> Geoff Callender skrev:
>>> The plot just thickened...
>>>
>>> Although option (a) fixes all TextField components, it has no
>>> effect on Select, DateField, checkbox, or expansions. Option (b)
>>> fixes it - that surely tells us that this is a bug?!?!?! Option
>>> (c) is enough to fix it, too.
>>>
>>> BTW I am using T5.0.6.
>>>
>>> Thanks,
>>>
>>> Geoff
>>>
>>>
>>> On 10/12/2007, at 9:35 PM, Geoff Callender wrote:
>>>
>>>> Hi,
>>>>
>>>> Is this a bug? I couldn't find it in JIRA. The user loses the
>>>> changes they typed into an "input" or "edit" page if an error is
>>>> recorded by onSuccess() AND the page is dealing with a client
>>>> persisted object. The page is redisplayed OK, with error, but
>>>> with the previous values!!!
>>>>
>>>> The user's changes aren't lost if
>>>> (a) I move the work that finds the error from onSuccess() into
>>>> onValidate(); or
>>>> (b) I add a simple client-persisted field to the page; or
>>>> (c) I replace client persistence with session persistence.
>>>>
>>>> To illustrate the problem, it's just like the example from http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html
>>>> , which contains these excerpts:
>>>>
>>>> @Persist
>>>> private String _userName;
>>>>
>>>> private String _password;
>>>>
>>>> String onSuccess()
>>>> {
>>>> if (!_authenticator.isValid(_userName, _password))
>>>> {
>>>> _form.recordError(_passwordField, "Invalid user name
>>>> or password.");
>>>> return null;
>>>> }
>>>>
>>>> return "PostLogin";
>>>> }
>>>>
>>>> except that instead of a single field, _userName, I am persisting
>>>> a whole object, _user:
>>>>
>>>> @Persist("client")
>>>> private User _user;
>>>>
>>>> and in the template we refer to its fields, eg:
>>>>
>>>> <input t:type="TextField" t:id="firstName"
>>>> value="user.firstName" ...
>>>>
>>>> If the user types a value into firstName, but the onSuccess()
>>>> method records an error, then the user loses what they typed.
>>>>
>>>> However, if I add another field to the page then everything works!
>>>>
>>>> @Persist("client")
>>>> private String _aField;
>>>>
>>>> <input t:type="TextField" t:id="aField" value="aField" ...
>>>>
>>>> Alternatively, it works if I do either of the other 2 things -
>>>> use session persistence or move all logic into onValidate().
>>>>
>>>> Anyone else seen this?
>>>>
>>>> Thanks,
>>>>
>>>> Geoff
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Client persistence bug? User typing lost.
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Looked at it, still looks like a bug.
I'd add it to JIRA, but you know exactly what's wrong. ;)
-Filip
Filip S. Adamsen skrev:
> I would definitely add a JIRA issue then, that sounds very suspicious.
>
> Oh, and maybe try the latest 5.0.7 snapshot if you can, but I don't
> think that'll help. In any case I'll look at it when I get home later
> today.
>
> -Filip
>
> Geoff Callender skrev:
>> The plot just thickened...
>>
>> Although option (a) fixes all TextField components, it has no effect
>> on Select, DateField, checkbox, or expansions. Option (b) fixes it -
>> that surely tells us that this is a bug?!?!?! Option (c) is enough to
>> fix it, too.
>>
>> BTW I am using T5.0.6.
>>
>> Thanks,
>>
>> Geoff
>>
>>
>> On 10/12/2007, at 9:35 PM, Geoff Callender wrote:
>>
>>> Hi,
>>>
>>> Is this a bug? I couldn't find it in JIRA. The user loses the
>>> changes they typed into an "input" or "edit" page if an error is
>>> recorded by onSuccess() AND the page is dealing with a client
>>> persisted object. The page is redisplayed OK, with error, but with
>>> the previous values!!!
>>>
>>> The user's changes aren't lost if
>>> (a) I move the work that finds the error from onSuccess() into
>>> onValidate(); or
>>> (b) I add a simple client-persisted field to the page; or
>>> (c) I replace client persistence with session persistence.
>>>
>>> To illustrate the problem, it's just like the example from
>>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html,
>>> which contains these excerpts:
>>>
>>> @Persist
>>> private String _userName;
>>>
>>> private String _password;
>>>
>>> String onSuccess()
>>> {
>>> if (!_authenticator.isValid(_userName, _password))
>>> {
>>> _form.recordError(_passwordField, "Invalid user name or
>>> password.");
>>> return null;
>>> }
>>>
>>> return "PostLogin";
>>> }
>>>
>>> except that instead of a single field, _userName, I am persisting a
>>> whole object, _user:
>>>
>>> @Persist("client")
>>> private User _user;
>>>
>>> and in the template we refer to its fields, eg:
>>>
>>> <input t:type="TextField" t:id="firstName"
>>> value="user.firstName" ...
>>>
>>> If the user types a value into firstName, but the onSuccess() method
>>> records an error, then the user loses what they typed.
>>>
>>> However, if I add another field to the page then everything works!
>>>
>>> @Persist("client")
>>> private String _aField;
>>>
>>> <input t:type="TextField" t:id="aField" value="aField" ...
>>>
>>> Alternatively, it works if I do either of the other 2 things - use
>>> session persistence or move all logic into onValidate().
>>>
>>> Anyone else seen this?
>>>
>>> Thanks,
>>>
>>> Geoff
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Client persistence bug? User typing lost.
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
I would definitely add a JIRA issue then, that sounds very suspicious.
Oh, and maybe try the latest 5.0.7 snapshot if you can, but I don't
think that'll help. In any case I'll look at it when I get home later today.
-Filip
Geoff Callender skrev:
> The plot just thickened...
>
> Although option (a) fixes all TextField components, it has no effect on
> Select, DateField, checkbox, or expansions. Option (b) fixes it - that
> surely tells us that this is a bug?!?!?! Option (c) is enough to fix
> it, too.
>
> BTW I am using T5.0.6.
>
> Thanks,
>
> Geoff
>
>
> On 10/12/2007, at 9:35 PM, Geoff Callender wrote:
>
>> Hi,
>>
>> Is this a bug? I couldn't find it in JIRA. The user loses the
>> changes they typed into an "input" or "edit" page if an error is
>> recorded by onSuccess() AND the page is dealing with a client
>> persisted object. The page is redisplayed OK, with error, but with
>> the previous values!!!
>>
>> The user's changes aren't lost if
>> (a) I move the work that finds the error from onSuccess() into
>> onValidate(); or
>> (b) I add a simple client-persisted field to the page; or
>> (c) I replace client persistence with session persistence.
>>
>> To illustrate the problem, it's just like the example from
>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html,
>> which contains these excerpts:
>>
>> @Persist
>> private String _userName;
>>
>> private String _password;
>>
>> String onSuccess()
>> {
>> if (!_authenticator.isValid(_userName, _password))
>> {
>> _form.recordError(_passwordField, "Invalid user name or
>> password.");
>> return null;
>> }
>>
>> return "PostLogin";
>> }
>>
>> except that instead of a single field, _userName, I am persisting a
>> whole object, _user:
>>
>> @Persist("client")
>> private User _user;
>>
>> and in the template we refer to its fields, eg:
>>
>> <input t:type="TextField" t:id="firstName"
>> value="user.firstName" ...
>>
>> If the user types a value into firstName, but the onSuccess() method
>> records an error, then the user loses what they typed.
>>
>> However, if I add another field to the page then everything works!
>>
>> @Persist("client")
>> private String _aField;
>>
>> <input t:type="TextField" t:id="aField" value="aField" ...
>>
>> Alternatively, it works if I do either of the other 2 things - use
>> session persistence or move all logic into onValidate().
>>
>> Anyone else seen this?
>>
>> Thanks,
>>
>> Geoff
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Client persistence bug? User typing lost.
Posted by Geoff Callender <ge...@mac.com>.
The plot just thickened...
Although option (a) fixes all TextField components, it has no effect
on Select, DateField, checkbox, or expansions. Option (b) fixes it -
that surely tells us that this is a bug?!?!?! Option (c) is enough to
fix it, too.
BTW I am using T5.0.6.
Thanks,
Geoff
On 10/12/2007, at 9:35 PM, Geoff Callender wrote:
> Hi,
>
> Is this a bug? I couldn't find it in JIRA. The user loses the
> changes they typed into an "input" or "edit" page if an error is
> recorded by onSuccess() AND the page is dealing with a client
> persisted object. The page is redisplayed OK, with error, but with
> the previous values!!!
>
> The user's changes aren't lost if
> (a) I move the work that finds the error from onSuccess() into
> onValidate(); or
> (b) I add a simple client-persisted field to the page; or
> (c) I replace client persistence with session persistence.
>
> To illustrate the problem, it's just like the example from http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html
> , which contains these excerpts:
>
> @Persist
> private String _userName;
>
> private String _password;
>
> String onSuccess()
> {
> if (!_authenticator.isValid(_userName, _password))
> {
> _form.recordError(_passwordField, "Invalid user name or
> password.");
> return null;
> }
>
> return "PostLogin";
> }
>
> except that instead of a single field, _userName, I am persisting a
> whole object, _user:
>
> @Persist("client")
> private User _user;
>
> and in the template we refer to its fields, eg:
>
> <input t:type="TextField" t:id="firstName"
> value="user.firstName" ...
>
> If the user types a value into firstName, but the onSuccess() method
> records an error, then the user loses what they typed.
>
> However, if I add another field to the page then everything works!
>
> @Persist("client")
> private String _aField;
>
> <input t:type="TextField" t:id="aField" value="aField" ...
>
> Alternatively, it works if I do either of the other 2 things - use
> session persistence or move all logic into onValidate().
>
> Anyone else seen this?
>
> Thanks,
>
> Geoff
Re: T5: Client persistence bug? User typing lost.
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
That would make sense.
-Filip
Geoff Callender skrev:
> I was wondering about that. Should the doco say the following instead,
> moving the business method into onValidate()?
>
> void onValidate()
> {
> if (!_authenticator.isValid(_userName, _password))
> {
> _form.recordError(_passwordField, "Invalid user name or
> password.");
> }
> }
>
> String onSuccess()
> {
> return "PostLogin";
> }
>
> On 10/12/2007, at 10:14 PM, Filip S. Adamsen wrote:
>
>> Hi,
>>
>> That example is, as far as I can tell, outdated. Doesn't mean this
>> isn't a bug, though.
>>
>> Why can't you just do your validation in onValidate? If it's a
>> question of outdated documentation, consider providing a documentation
>> patch.
>>
>> I'm planning to contribute some patches as soon as I've gotten a bit
>> more used to IntelliJ IDEA, as I just converted from Eclipse and need
>> to get used to it. Loving it so far, by the way.
>>
>> -Filip
>>
>> Geoff Callender skrev:
>>> Hi,
>>> Is this a bug? I couldn't find it in JIRA. The user loses the
>>> changes they typed into an "input" or "edit" page if an error is
>>> recorded by onSuccess() AND the page is dealing with a client
>>> persisted object. The page is redisplayed OK, with error, but with
>>> the previous values!!!
>>> The user's changes aren't lost if
>>> (a) I move the work that finds the error from onSuccess() into
>>> onValidate(); or
>>> (b) I add a simple client-persisted field to the page; or
>>> (c) I replace client persistence with session persistence.
>>> To illustrate the problem, it's just like the example from
>>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html,
>>> which contains these excerpts:
>>> @Persist
>>> private String _userName;
>>> private String _password;
>>> String onSuccess()
>>> {
>>> if (!_authenticator.isValid(_userName, _password))
>>> {
>>> _form.recordError(_passwordField, "Invalid user name or
>>> password.");
>>> return null;
>>> }
>>> return "PostLogin";
>>> }
>>> except that instead of a single field, _userName, I am persisting a
>>> whole object, _user:
>>> @Persist("client")
>>> private User _user;
>>> and in the template we refer to its fields, eg:
>>> <input t:type="TextField" t:id="firstName"
>>> value="user.firstName" ...
>>> If the user types a value into firstName, but the onSuccess() method
>>> records an error, then the user loses what they typed.
>>> However, if I add another field to the page then everything works!
>>> @Persist("client")
>>> private String _aField;
>>> <input t:type="TextField" t:id="aField" value="aField" ...
>>> Alternatively, it works if I do either of the other 2 things - use
>>> session persistence or move all logic into onValidate().
>>> Anyone else seen this?
>>> Thanks,
>>> Geoff
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Client persistence bug? User typing lost.
Posted by Geoff Callender <ge...@gmail.com>.
I was wondering about that. Should the doco say the following
instead, moving the business method into onValidate()?
void onValidate()
{
if (!_authenticator.isValid(_userName, _password))
{
_form.recordError(_passwordField, "Invalid user name or
password.");
}
}
String onSuccess()
{
return "PostLogin";
}
On 10/12/2007, at 10:14 PM, Filip S. Adamsen wrote:
> Hi,
>
> That example is, as far as I can tell, outdated. Doesn't mean this
> isn't a bug, though.
>
> Why can't you just do your validation in onValidate? If it's a
> question of outdated documentation, consider providing a
> documentation patch.
>
> I'm planning to contribute some patches as soon as I've gotten a bit
> more used to IntelliJ IDEA, as I just converted from Eclipse and
> need to get used to it. Loving it so far, by the way.
>
> -Filip
>
> Geoff Callender skrev:
>> Hi,
>> Is this a bug? I couldn't find it in JIRA. The user loses the
>> changes they typed into an "input" or "edit" page if an error is
>> recorded by onSuccess() AND the page is dealing with a client
>> persisted object. The page is redisplayed OK, with error, but with
>> the previous values!!!
>> The user's changes aren't lost if
>> (a) I move the work that finds the error from onSuccess() into
>> onValidate(); or
>> (b) I add a simple client-persisted field to the page; or
>> (c) I replace client persistence with session persistence.
>> To illustrate the problem, it's just like the example from http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html
>> , which contains these excerpts:
>> @Persist
>> private String _userName;
>> private String _password;
>> String onSuccess()
>> {
>> if (!_authenticator.isValid(_userName, _password))
>> {
>> _form.recordError(_passwordField, "Invalid user name or
>> password.");
>> return null;
>> }
>> return "PostLogin";
>> }
>> except that instead of a single field, _userName, I am persisting a
>> whole object, _user:
>> @Persist("client")
>> private User _user;
>> and in the template we refer to its fields, eg:
>> <input t:type="TextField" t:id="firstName"
>> value="user.firstName" ...
>> If the user types a value into firstName, but the onSuccess()
>> method records an error, then the user loses what they typed.
>> However, if I add another field to the page then everything works!
>> @Persist("client")
>> private String _aField;
>> <input t:type="TextField" t:id="aField" value="aField" ...
>> Alternatively, it works if I do either of the other 2 things - use
>> session persistence or move all logic into onValidate().
>> Anyone else seen this?
>> Thanks,
>> Geoff
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
Re: T5: Client persistence bug? User typing lost.
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,
That example is, as far as I can tell, outdated. Doesn't mean this isn't
a bug, though.
Why can't you just do your validation in onValidate? If it's a question
of outdated documentation, consider providing a documentation patch.
I'm planning to contribute some patches as soon as I've gotten a bit
more used to IntelliJ IDEA, as I just converted from Eclipse and need to
get used to it. Loving it so far, by the way.
-Filip
Geoff Callender skrev:
> Hi,
>
> Is this a bug? I couldn't find it in JIRA. The user loses the changes
> they typed into an "input" or "edit" page if an error is recorded by
> onSuccess() AND the page is dealing with a client persisted object. The
> page is redisplayed OK, with error, but with the previous values!!!
>
> The user's changes aren't lost if
> (a) I move the work that finds the error from onSuccess() into
> onValidate(); or
> (b) I add a simple client-persisted field to the page; or
> (c) I replace client persistence with session persistence.
>
> To illustrate the problem, it's just like the example from
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html,
> which contains these excerpts:
>
> @Persist
> private String _userName;
>
> private String _password;
>
> String onSuccess()
> {
> if (!_authenticator.isValid(_userName, _password))
> {
> _form.recordError(_passwordField, "Invalid user name or
> password.");
> return null;
> }
>
> return "PostLogin";
> }
>
> except that instead of a single field, _userName, I am persisting a
> whole object, _user:
>
> @Persist("client")
> private User _user;
>
> and in the template we refer to its fields, eg:
>
> <input t:type="TextField" t:id="firstName"
> value="user.firstName" ...
>
> If the user types a value into firstName, but the onSuccess() method
> records an error, then the user loses what they typed.
>
> However, if I add another field to the page then everything works!
>
> @Persist("client")
> private String _aField;
>
> <input t:type="TextField" t:id="aField" value="aField" ...
>
> Alternatively, it works if I do either of the other 2 things - use
> session persistence or move all logic into onValidate().
>
> Anyone else seen this?
>
> Thanks,
>
> Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org