Re: Ajax form components principles

2008-10-27 Thread Igor Vaynberg
if you dont want the model updated why are you using a
ajaxformcomponentupdatingbehavior?

-igor

On Sun, Oct 26, 2008 at 6:04 PM, Dreamage [EMAIL PROTECTED] wrote:

 Hi,

 Suppose I have a form with an ajax checkbox inside it. Whenever I
 check/uncheck the checkbox, the associated model is updated. The problem is
 that if the the checkbox uses a propertymodel targetting a object from my
 database (using a datachable model to retrieve it), then the object is
 modified in the database and I haven't submit the form yet. If the form have
 a cancel button, my object could still be modified if I used the checkbox
 before using cancel.

 I read somewhere that ajax components should not modify the object until
 form post (can't remember where), so should I use a temporary model as the
 ajax checkbox model and apply the value to my database object when the form
 is submitted ? If yes, where should I place this code or is there a better
 way to do this ?

 Thanks
 --
 View this message in context: 
 http://www.nabble.com/Ajax-form-components-principles-tp20180246p20180246.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ajax form components principles

2008-10-27 Thread Dreamage

Because I want to trigger a show/hide for a textfield when the checkbox is
checked/unchecked.

-- 
View this message in context: 
http://www.nabble.com/Ajax-form-components-principles-tp20180246p20198345.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ajax form components principles

2008-10-27 Thread Dreamage

Anyway the point is that when using ajax components, the associated model is
updated but the form may not be submitted yet, so how would you implement a
cancel button to undo the ajax model updates ? Do we have to do all this by
hand (storing ajax model updates in temporary variables and applying the
values to the real models in the onSubmit method of the form) or is there
another way ?

-- 
View this message in context: 
http://www.nabble.com/Ajax-form-components-principles-tp20180246p20198434.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ajax form components principles

2008-10-27 Thread James Carman
You can use wicketopia's ProxyModelManager, if you want:

https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/proxy/ProxyModelManager.java

This way, you bind your components to proxied models.  When you're
ready to really write the values into the real models, you can call
commit() on the manager and it'll take care of pushing the values from
the proxied models into the actual models.



On Mon, Oct 27, 2008 at 7:14 PM, Dreamage [EMAIL PROTECTED] wrote:

 Anyway the point is that when using ajax components, the associated model is
 updated but the form may not be submitted yet, so how would you implement a
 cancel button to undo the ajax model updates ? Do we have to do all this by
 hand (storing ajax model updates in temporary variables and applying the
 values to the real models in the onSubmit method of the form) or is there
 another way ?

 --
 View this message in context: 
 http://www.nabble.com/Ajax-form-components-principles-tp20180246p20198434.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ajax form components principles

2008-10-27 Thread Igor Vaynberg
you are using ajaxformcomponentupdatingbehavior which is made
specifically for updating components. nothing is stopping you from
using ajaxeventbehavior to bypass default form processing and do
whatever you want however you want.

what we offer here are the defaults, they do not use any special api
that you do not have access to. if the default doesnt work how you
want then roll your own.

you might think that the default is backwards, but consider this: you
are the first person to think its backwards in well over a couple of
years that wicket had ajax support.

-igor

On Mon, Oct 27, 2008 at 4:14 PM, Dreamage [EMAIL PROTECTED] wrote:

 Anyway the point is that when using ajax components, the associated model is
 updated but the form may not be submitted yet, so how would you implement a
 cancel button to undo the ajax model updates ? Do we have to do all this by
 hand (storing ajax model updates in temporary variables and applying the
 values to the real models in the onSubmit method of the form) or is there
 another way ?

 --
 View this message in context: 
 http://www.nabble.com/Ajax-form-components-principles-tp20180246p20198434.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ajax form components principles

2008-10-27 Thread Dreamage

Thanks jwcarman, thats a very good track. I'll look into it.


jwcarman wrote:
 
 You can use wicketopia's ProxyModelManager, if you want:
 
 https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/proxy/ProxyModelManager.java
 
 This way, you bind your components to proxied models.  When you're
 ready to really write the values into the real models, you can call
 commit() on the manager and it'll take care of pushing the values from
 the proxied models into the actual models.
 
 

-- 
View this message in context: 
http://www.nabble.com/Ajax-form-components-principles-tp20180246p20200715.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]