t5: rollback when profile update is cancelled with beaneditform

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

t5: rollback when profile update is cancelled with beaneditform

britske

hi,

I was quickly testing creating and updating userprofiles using beaneditform.
To me, the most logical thing to do was combine Create and Update in one
page:

if a User-instance exists in the applicationstate --> user is displayed
using beaneditform and fields can be edited,
if no user-instance exists in the applicaitonstate or no applicaiton state
exists --> create new user-instance

all works fine, except that I want a cancel button to exist, which rollbacks
all actions performed on the bound user-instance. So, if the user instance
already existed before, it should rollback to the field-values before
opening the edit screen.

Since editing the beaneditform directly sets the fields of the
user-instance, all old values are overwritten.

The question: of course I can get the persisted user from db when the
'cancel'-button is pressed and overwrite the user in applicationstate with
this fetched used from db, but this requires a db-call which I want to
avoid.

Best would be to create a clone of the user-instance in onActivate which I
can use instead of the fetched instance from db. However, the fields of the
user-profiel are likely to change, so I want to clone 'dynamically'.

Any bean*-functionality that I can leverage for this?

Moreover, about that cancel-button, does beaneditform has an option to
display a cancel-button or something alike, with events I can bind to?

Thanks in advance,
Geert-Jan
--
View this message in context: http://www.nabble.com/t5%3A-rollback-when-profile-update-is-cancelled-with-beaneditform-tp18320046p18320046.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...