You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark Reynolds <sc...@tailwaggers.com> on 2006/04/05 00:17:59 UTC
Not restoring user's values after form error
I have a page with a form for editing an object. I am using optimistic
locking. I catch the optimistic lock exception in the listener method
and add a message to the validation delegate indicating that another
user changed the record. In this case, I want to have the form show the
current values rather than the values just submitted by the user. Any
tips for doing this?
Thanks.
-- Mark R
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Not restoring user's values after form error
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
You might be interested in Tapestry-Flash - if you're on T4:
http://howardlewisship.com/tapestry-javaforge/tapestry-flash/
-Filip
Mark Reynolds skrev:
> Tried .forgetPage() didn't it work either.
>
> I ended up making the page an IExternalPage and doing a callback to
> itself, passing the error message as one of the parameters. Then I
> record the message on the delegate in the .activateExternalPage()
> method. Still not sure if this is the best way, but it works.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Not restoring user's values after form error
Posted by Mark Reynolds <sc...@tailwaggers.com>.
Tried .forgetPage() didn't it work either.
I ended up making the page an IExternalPage and doing a callback to
itself, passing the error message as one of the parameters. Then I
record the message on the delegate in the .activateExternalPage()
method. Still not sure if this is the best way, but it works.
Filip S. Adamsen wrote:
> How about using IRequestCycle#forgetPage?
>
> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/IRequestCycle.html#forgetPage(java.lang.String)
>
>
> -Filip
>
> Mark Reynolds skrev:
>> I tried .clear(), but that didn't work.
>>
>> I tried injecting another instance of the same page, initializing it,
>> and returning it from the listener method as if I were coming to it
>> from another page, but that did not work either.
>>
>> Right now my solution is to go to another page to display the message
>> and give a link to "try again" to return to the editing page.
>>
>> I feel like I am missing some straightforward way to reload the page
>> from scratch. If it was an external page I throw an exception to
>> redirect to it, but that would be another round trip to the browser.
>>
>> -- Mark R
>>
>> Filip S. Adamsen wrote:
>>> Perhaps using IValidationDelegate#setFormComponent and
>>> ValidationDelegate#recordFieldInputValue to store the new values
>>> would work? It feels like a hack to me, but that doesn't mean it
>>> won't work.
>>>
>>> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#setFormComponent(org.apache.tapestry.form.IFormComponent)
>>>
>>> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#recordFieldInputValue(java.lang.String)
>>>
>>>
>>> Or else you might get away with calling IValidationDelegate#clear and
>>> then recording your error. That might work as well.
>>>
>>> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#clear()
>>>
>>>
>>> If none of it works, well, then I blame it on lack of coffee - it's
>>> well beyond midnight here. ; )
>>>
>>> -Filip
>>>
>>> Mark Reynolds skrev:
>>>> I have a page with a form for editing an object. I am using
>>>> optimistic locking. I catch the optimistic lock exception in the
>>>> listener method and add a message to the validation delegate
>>>> indicating that another user changed the record. In this case, I
>>>> want to have the form show the current values rather than the values
>>>> just submitted by the user. Any tips for doing this?
>>>>
>>>> Thanks.
>>>>
>>>> -- Mark R
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Not restoring user's values after form error
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
How about using IRequestCycle#forgetPage?
http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/IRequestCycle.html#forgetPage(java.lang.String)
-Filip
Mark Reynolds skrev:
> I tried .clear(), but that didn't work.
>
> I tried injecting another instance of the same page, initializing it,
> and returning it from the listener method as if I were coming to it from
> another page, but that did not work either.
>
> Right now my solution is to go to another page to display the message
> and give a link to "try again" to return to the editing page.
>
> I feel like I am missing some straightforward way to reload the page
> from scratch. If it was an external page I throw an exception to
> redirect to it, but that would be another round trip to the browser.
>
> -- Mark R
>
> Filip S. Adamsen wrote:
>> Perhaps using IValidationDelegate#setFormComponent and
>> ValidationDelegate#recordFieldInputValue to store the new values would
>> work? It feels like a hack to me, but that doesn't mean it won't work.
>>
>> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#setFormComponent(org.apache.tapestry.form.IFormComponent)
>>
>> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#recordFieldInputValue(java.lang.String)
>>
>>
>> Or else you might get away with calling IValidationDelegate#clear and
>> then recording your error. That might work as well.
>>
>> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#clear()
>>
>>
>> If none of it works, well, then I blame it on lack of coffee - it's
>> well beyond midnight here. ; )
>>
>> -Filip
>>
>> Mark Reynolds skrev:
>>> I have a page with a form for editing an object. I am using
>>> optimistic locking. I catch the optimistic lock exception in the
>>> listener method and add a message to the validation delegate
>>> indicating that another user changed the record. In this case, I want
>>> to have the form show the current values rather than the values just
>>> submitted by the user. Any tips for doing this?
>>>
>>> Thanks.
>>>
>>> -- Mark R
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Not restoring user's values after form error
Posted by Mark Reynolds <sc...@tailwaggers.com>.
I tried .clear(), but that didn't work.
I tried injecting another instance of the same page, initializing it,
and returning it from the listener method as if I were coming to it from
another page, but that did not work either.
Right now my solution is to go to another page to display the message
and give a link to "try again" to return to the editing page.
I feel like I am missing some straightforward way to reload the page
from scratch. If it was an external page I throw an exception to
redirect to it, but that would be another round trip to the browser.
-- Mark R
Filip S. Adamsen wrote:
> Perhaps using IValidationDelegate#setFormComponent and
> ValidationDelegate#recordFieldInputValue to store the new values would
> work? It feels like a hack to me, but that doesn't mean it won't work.
>
> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#setFormComponent(org.apache.tapestry.form.IFormComponent)
>
> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#recordFieldInputValue(java.lang.String)
>
>
> Or else you might get away with calling IValidationDelegate#clear and
> then recording your error. That might work as well.
>
> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#clear()
>
>
> If none of it works, well, then I blame it on lack of coffee - it's well
> beyond midnight here. ; )
>
> -Filip
>
> Mark Reynolds skrev:
>> I have a page with a form for editing an object. I am using optimistic
>> locking. I catch the optimistic lock exception in the listener method
>> and add a message to the validation delegate indicating that another
>> user changed the record. In this case, I want to have the form show
>> the current values rather than the values just submitted by the user.
>> Any tips for doing this?
>>
>> Thanks.
>>
>> -- Mark R
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Not restoring user's values after form error
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Perhaps using IValidationDelegate#setFormComponent and
ValidationDelegate#recordFieldInputValue to store the new values would
work? It feels like a hack to me, but that doesn't mean it won't work.
http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#setFormComponent(org.apache.tapestry.form.IFormComponent)
http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#recordFieldInputValue(java.lang.String)
Or else you might get away with calling IValidationDelegate#clear and
then recording your error. That might work as well.
http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/valid/IValidationDelegate.html#clear()
If none of it works, well, then I blame it on lack of coffee - it's well
beyond midnight here. ; )
-Filip
Mark Reynolds skrev:
> I have a page with a form for editing an object. I am using optimistic
> locking. I catch the optimistic lock exception in the listener method
> and add a message to the validation delegate indicating that another
> user changed the record. In this case, I want to have the form show the
> current values rather than the values just submitted by the user. Any
> tips for doing this?
>
> Thanks.
>
> -- Mark R
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org