You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tim Koop <ti...@timkoop.com> on 2010/09/15 18:38:23 UTC
How to display form success?
Hi everyone. I hope this is a quick and easy question.
I want to show a "Form successfully submitted" message, so in my Page
object I have this:
@Persist
@Property
private boolean showSuccess;
Then in my onSuccess method I have this:
private void onSuccess() {
...
showSuccess = true;
}
My question is this: where do I set showSuccess to be false? If the
user ever comes back to the page again, the value will still be true but
it should be false. If I set it false in pageLoaded or pageAttached, it
will always be false because that happens after onSuccess (on the reload).
Thanks.
--
Tim Koop
tim@timkoop.com <ma...@timkoop.com>
www.timkoop.com <http://www.timkoop.com>
Re: How to display form success?
Posted by Elin <po...@gmail.com>.
Im a bit newbie but im thinking that you could just check the boolean after
render is done and if the boolean is true, set it to false again :/
--
View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-display-form-success-tp2840958p2841099.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How to display form success?
Posted by Rich M <ri...@moremagic.com>.
Here is how I tend to handle it:
@Property @Persist("flash")
private String commitMessage;
public void onPrepare(){
if(commitMessage == null)
commitMessage = "";
}
void onSuccessFromUserForm(){
try{
//update call
commitMessage = "User " + user.getId() + " was successfully
updated!";
}catch(Exception e){
commitMessage = "Failed to update user " + user.getId();
}
}
then in the tml I just have ${commitMessage} where I want it to display.
If there is a reason this won't work, you could consider making the
boolean false at a later render phase like afterRender I'd imagine.
-Rich
On 09/15/2010 12:38 PM, Tim Koop wrote:
> Hi everyone. I hope this is a quick and easy question.
>
> I want to show a "Form successfully submitted" message, so in my Page
> object I have this:
>
> @Persist
> @Property
> private boolean showSuccess;
>
> Then in my onSuccess method I have this:
>
> private void onSuccess() {
> ...
> showSuccess = true;
> }
>
> My question is this: where do I set showSuccess to be false? If the
> user ever comes back to the page again, the value will still be true
> but it should be false. If I set it false in pageLoaded or
> pageAttached, it will always be false because that happens after
> onSuccess (on the reload).
>
> Thanks.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How to display form success?
Posted by "Joost Schouten (ml)" <jo...@jsportal.com>.
Use: @Persist(PersistenceConstants.FLASH)
Cheers,
Joost
On 15/09/10 6:38 PM, Tim Koop wrote:
> Hi everyone. I hope this is a quick and easy question.
>
> I want to show a "Form successfully submitted" message, so in my Page
> object I have this:
>
> @Persist
> @Property
> private boolean showSuccess;
>
> Then in my onSuccess method I have this:
>
> private void onSuccess() {
> ...
> showSuccess = true;
> }
>
> My question is this: where do I set showSuccess to be false? If the
> user ever comes back to the page again, the value will still be true
> but it should be false. If I set it false in pageLoaded or
> pageAttached, it will always be false because that happens after
> onSuccess (on the reload).
>
> Thanks.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org