Re: [Wicket-user] Preserve form state

2005-11-26 Thread Matej Knopp

Now this is great, I really like it ;)

Thanks to everyone involved.

-Matej

Eelco Hillenius wrote:

Also please note that we're in the middle of refactoring some of the
wicket internals, and the solution as currently implemented might
change a bit still (though hopefully only the internals). Hope to be
done with the larger part after this weekend.

Eelco


On 11/25/05, Laurent PETIT [EMAIL PROTECTED] wrote:


For the ones monitoring this thread,

I'm pleased to announce that - thanks to Johan-, a solution to the
problem exposed by Matej has been implemented in wicket-core.

This is good news, as everybody's app users will benefit from this.

And that's good for you too Matej, since it implies that you can get
rid of the temporary speficic solution of using custon Form,
FeedBackPanel, 

From now on, when you set defaultFormProcessing to off, the
FormComponents that are childrens of the Form  will registered the
user inputs in a private area, in order to be re-displayed later, be
it because the form is invalid, or just rendered again.

The behaviour when rendering again a non validated form will be the
same as when rendering again a form that is invalid. For example: the
form will still not be able to re-fill a input type=file
component, the behaviour of the input type=password component will
still get the value of the model (and not re-render the value of the
user input ...).

For Custom Components Developer :
just call in your own onRenderTag() method the
FormComponent.getValue(), just as before.


HTH

--
Laurent


On 11/18/05, Laurent PETIT [EMAIL PROTECTED] wrote:


Whoops, the missing test files in attachment ... :-)

On 11/18/05, Laurent PETIT [EMAIL PROTECTED] wrote:


OK, now I have a first attempt to submit.

It is what could be considered as a cleaner way to address Matej's
initial problem.
But it is a hack to the core, so it's normal that I've come up with
something cleaner I think.

And as it's a modification to the core, it's also more error-prone.

It is too late tonight for me to explain what I did, so please for the
moment take a look at the 2 new classes versions :

wicket.markup.html.form.Form
wicket.markup.html.form.FormComponent

or the diffs files if you prefer.

And I've joined 2 very basic test files (markup  class)

In short : in the new version, on formSubmitted(), child form
components are told that a new user input is available (method
FormComponent.newUserInputAvailable()).
In this method, the FormComponent stores the user input in a rawInput field.
This rawInput is then available for re-rendering for both use cases :
when data is invalid and when model is not up to date (for example
when returning from another page as in Matej's use case, the form will
be rendered again with the rawInput, and not the model).

You can see that it also frees the FormComponent code from the weird
NO_INVALID_INPUT constant (by using a modelUpToDate boolean field)

Fiuu, time to sleep now ! :-)

regards,

--
laurent









---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865opclick
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-25 Thread Laurent PETIT
For the ones monitoring this thread,

I'm pleased to announce that - thanks to Johan-, a solution to the
problem exposed by Matej has been implemented in wicket-core.

This is good news, as everybody's app users will benefit from this.

And that's good for you too Matej, since it implies that you can get
rid of the temporary speficic solution of using custon Form,
FeedBackPanel, 

From now on, when you set defaultFormProcessing to off, the
FormComponents that are childrens of the Form  will registered the
user inputs in a private area, in order to be re-displayed later, be
it because the form is invalid, or just rendered again.

The behaviour when rendering again a non validated form will be the
same as when rendering again a form that is invalid. For example: the
form will still not be able to re-fill a input type=file
component, the behaviour of the input type=password component will
still get the value of the model (and not re-render the value of the
user input ...).

For Custom Components Developer :
just call in your own onRenderTag() method the
FormComponent.getValue(), just as before.


HTH

--
Laurent


On 11/18/05, Laurent PETIT [EMAIL PROTECTED] wrote:
 Whoops, the missing test files in attachment ... :-)

 On 11/18/05, Laurent PETIT [EMAIL PROTECTED] wrote:
  OK, now I have a first attempt to submit.
 
  It is what could be considered as a cleaner way to address Matej's
  initial problem.
  But it is a hack to the core, so it's normal that I've come up with
  something cleaner I think.
 
  And as it's a modification to the core, it's also more error-prone.
 
  It is too late tonight for me to explain what I did, so please for the
  moment take a look at the 2 new classes versions :
 
  wicket.markup.html.form.Form
  wicket.markup.html.form.FormComponent
 
  or the diffs files if you prefer.
 
  And I've joined 2 very basic test files (markup  class)
 
  In short : in the new version, on formSubmitted(), child form
  components are told that a new user input is available (method
  FormComponent.newUserInputAvailable()).
  In this method, the FormComponent stores the user input in a rawInput field.
  This rawInput is then available for re-rendering for both use cases :
  when data is invalid and when model is not up to date (for example
  when returning from another page as in Matej's use case, the form will
  be rendered again with the rawInput, and not the model).
 
  You can see that it also frees the FormComponent code from the weird
  NO_INVALID_INPUT constant (by using a modelUpToDate boolean field)
 
  Fiuu, time to sleep now ! :-)
 
  regards,
 
  --
  laurent
 
 
 





---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-25 Thread Eelco Hillenius
Also please note that we're in the middle of refactoring some of the
wicket internals, and the solution as currently implemented might
change a bit still (though hopefully only the internals). Hope to be
done with the larger part after this weekend.

Eelco


On 11/25/05, Laurent PETIT [EMAIL PROTECTED] wrote:
 For the ones monitoring this thread,

 I'm pleased to announce that - thanks to Johan-, a solution to the
 problem exposed by Matej has been implemented in wicket-core.

 This is good news, as everybody's app users will benefit from this.

 And that's good for you too Matej, since it implies that you can get
 rid of the temporary speficic solution of using custon Form,
 FeedBackPanel, 

 From now on, when you set defaultFormProcessing to off, the
 FormComponents that are childrens of the Form  will registered the
 user inputs in a private area, in order to be re-displayed later, be
 it because the form is invalid, or just rendered again.

 The behaviour when rendering again a non validated form will be the
 same as when rendering again a form that is invalid. For example: the
 form will still not be able to re-fill a input type=file
 component, the behaviour of the input type=password component will
 still get the value of the model (and not re-render the value of the
 user input ...).

 For Custom Components Developer :
 just call in your own onRenderTag() method the
 FormComponent.getValue(), just as before.


 HTH

 --
 Laurent


 On 11/18/05, Laurent PETIT [EMAIL PROTECTED] wrote:
  Whoops, the missing test files in attachment ... :-)
 
  On 11/18/05, Laurent PETIT [EMAIL PROTECTED] wrote:
   OK, now I have a first attempt to submit.
  
   It is what could be considered as a cleaner way to address Matej's
   initial problem.
   But it is a hack to the core, so it's normal that I've come up with
   something cleaner I think.
  
   And as it's a modification to the core, it's also more error-prone.
  
   It is too late tonight for me to explain what I did, so please for the
   moment take a look at the 2 new classes versions :
  
   wicket.markup.html.form.Form
   wicket.markup.html.form.FormComponent
  
   or the diffs files if you prefer.
  
   And I've joined 2 very basic test files (markup  class)
  
   In short : in the new version, on formSubmitted(), child form
   components are told that a new user input is available (method
   FormComponent.newUserInputAvailable()).
   In this method, the FormComponent stores the user input in a rawInput 
   field.
   This rawInput is then available for re-rendering for both use cases :
   when data is invalid and when model is not up to date (for example
   when returning from another page as in Matej's use case, the form will
   be rendered again with the rawInput, and not the model).
  
   You can see that it also frees the FormComponent code from the weird
   NO_INVALID_INPUT constant (by using a modelUpToDate boolean field)
  
   Fiuu, time to sleep now ! :-)
  
   regards,
  
   --
   laurent
  
  
  
 
 
 


 ---
 This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
 for problems?  Stop!  Download the new AJAX search engine that makes
 searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
 http://ads.osdn.com/?ad_idv37alloc_id865opclick
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-17 Thread Matej Knopp
Well, having to do validation in model seems like a step backwards from 
what I have now. There are already validators that can be attached to 
objects, no to mention, that I would have issues with feedback, etc.


I still don't think layered model is a way to go. Currently, I have a 
solution, that works well form me. But it has two drawbacks.


1. It's really hacky.

2. It uses the invalidInput property of form components to store 
temporary values. When clicking on an ImmediateButton, all form 
components are marked invalid (so that they remember the values in 
invalidInput) and all feedbackMessages are supressed. So after clicking 
immediateButton, all feedback messages are hidden (even the valid one).


The advantages are that validation works as usual.

I'm attaching the source code in case anyone needs this. It seems that 
this behavior (not implementation) won't have enough support to get into 
wicket.


-Matej


Johan Compagner wrote:

first of all we are talking about 2 problems here!

Matej's and Laurent problems are completely different.

I still believe that Matej should use a temp model (in between model)
And the validations shouldn't be on the component level but between the 
between model and the real (strong typed) model.
I really believe this is the best way. Any thing i can currently think 
of will result in something like that anyway.. The values Need to be 
stored somewhere!!

So having something like a model:

Model(Model realModel)
{
Hashmap values;

getObject(Component comp)  return values.get(comp);
setObject(Component comp, Object value) values.put(comp, value);

   public void saveToReal()
   {

Object realObject = realModel.getObject(null);

while( Iterate over the values maps keys)
Component key;
String stringValue;
Object value = converter.convertToType(stringValue);
validator.validate(key,value)
String id = key.getId() // or get some kind of binding 
see BoundedCompoundPropertyModel

Objects.setValue(id,realObject,value,null);
   }
}

this is just a rought idea how a in between model should or could work.


Laurents problem is completely different, He doesn't want to hold the 
data (and do nothing with it) over multiply pages.
He just wants portions to be validated and portions to be kept for one 
request only but not validated.
I think this is now already possible with the 
Button.defaultFormProcessing boolean
Then the buttons must have a list of components which he must be 
validated before he does process everything.
then he can call FormComponent.validate() and if that goes ok 
FormComponent.updateModel() (and so on on the complete List)


I think we are then where we are. You just need a special button that 
has a list of FormComponents to be validated...




On 11/16/05, *Johan Compagner* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


i still think in youre case you have to use a inbetween model
There is no other way. Even if we stored it inside the form itself
then that is the inbetween model
And i don't know if i want to support that.




On 11/16/05, *Matej Knopp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
wrote:

Hi.

The problem is, that I don't want to validate the form, unless user
clicks 'OK'. The model is updated after validation only. But the
'choose' button should NOT validate the form.

I don't think it's a good thing storing the temporary values in
model
(at least in my case), because model is typed. The temporary values
should only be strings (get from Http request).

-Matej

Johan Compagner wrote:

 Just one extra remark.
 Why can't use just use a model for this?
 And that model is an in between model for you real model object?

 Ok you have to do youre validation a bit different  (it can't

be between

 Form-Model
 but it has to be between TmpModel-RealModel

 This looks to me like a much better way to have multiply page

forms...


 johan


 On 11/13/05, *Matej Knopp*  [EMAIL PROTECTED]

mailto:[EMAIL PROTECTED] mailto: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:


Hi.

I know this has been discussed already, but still I'm

opening it once

more. I think there should be a way to preserve form state

without

validation and model updating.

The use case is following.
I have a (complex) form with some fields, that can not be

entered

directly, i.e. they have to be selected on other page. So I

need to move

between pages, but I don't want to lose any information

entered on the

previous page. If I use Button, the form gets processed,

validated, etc

and the action won't execute unless all entered data is

valid. If I turn

defaultProcessing off, the action executes, but the data

  

Re: [Wicket-user] Preserve form state

2005-11-17 Thread Laurent PETIT
Thanks a lot for having sent the source code.
I'll check it ASAP (but not before next week, I fear), because I'm
*very* interested in encapsulating the behaviour you're talking about
in a reusable package.

I already have some ideas under the cover, but I'm far to having good
knowledges of Wicket internals, and I guess your code will help me
delve into those internals.

In short, my idea, if feasible, would be to create a kind of
SmartForm that could be a border around other FormComponents, and
even embed other SmartForms.
And a SmartForm validation will be bound to a set of Buttons/Actions
explicitly added to the SmartForm using something like
SmartForm.validateOnButton/Action(Button/Action).

And you could also cascade validation : if a SmartForm b is embedded
in another SmartForm a, you can choose on the SmartForm b if
validation of the parent SmartForm (a) will cascade the validation
to the SmartForm b.

So you then have a SmartForm b, attached to a validation button
bButton, and the SmartForm a, attached to a validation button
aButton

If b declares that validations cascade through it, then the
following use cases will be as follows :

- user presses bButton : only the validations of the b SmartForm
are done (and also updates of the b models). The values entered by
the user on the other formComponents of the a SmartForm are
preserved (and here your code is of some interest to me).
- user presses aButton : the validation occurs on all the
formComponents inside the a SmartForm, and also on all the
SmartForms that accept validation cascading, so formComponents of b
SmartForm are also validated.

Another interesting use case that is solved by this solution is the
use case where in the same form you have some formComponents needed
for the creation of something, and associated to a Create Button,
and some other formComponents that display the contents of (editable)
already created somethings (for bulk updates).

Then you create 2 SmartForms : one SmartForm (lets call it
createForm) for the formComponents needed when the user hits the
Create Button (that then *need* to be validated), and one SmartForm
for the formComponents of the rest of the page (lets call it
updateForm, and say that it's bound to the global submit button of
the page).
And to end the settings of your components, you call some
createForm.setCascadeValidation(false).

Then when the global submit button of the page is called on the global
updateForm, if the createForm is embedded in the updateForm,
then validation will not occur on the createForm SmartForm (and
that's good !).

A last interesting use case for this :
in all the pages of you application, you have a little box that allows
the user to sign in.
A user hits a page where he can enter some values in some fields. And
before validating the page, he decides to log in. What I want is that
after having logged in, the page still presents the values entered in
its body by the user.
So the need to :
- have a single form for all the data of the page
- use a concept like my SmartForm in order to separate the
formComponents dedicated to the user login action (presumably
login/password :-) from the formComponents of the main purpose of the
page at hand (some blog entry formComponents, ... whatever ...).
Without the use of a concept like SmartForms and changes in Components
as those mentioned by Matej, it will be very difficult, verbose, and
error prone to have this *simple* and *basic* (user friendly centered)
behaviour on all the pages of an application ...

But yet, it is still all in my head, I have nothing to present yet
(but I hope it will come soon).

My 0,05 EUR, :-)

--
Laurent




On 11/17/05, Matej Knopp [EMAIL PROTECTED] wrote:
 Well, having to do validation in model seems like a step backwards from
 what I have now. There are already validators that can be attached to
 objects, no to mention, that I would have issues with feedback, etc.

 I still don't think layered model is a way to go. Currently, I have a
 solution, that works well form me. But it has two drawbacks.

 1. It's really hacky.

 2. It uses the invalidInput property of form components to store
 temporary values. When clicking on an ImmediateButton, all form
 components are marked invalid (so that they remember the values in
 invalidInput) and all feedbackMessages are supressed. So after clicking
 immediateButton, all feedback messages are hidden (even the valid one).

 The advantages are that validation works as usual.

 I'm attaching the source code in case anyone needs this. It seems that
 this behavior (not implementation) won't have enough support to get into
 wicket.

 -Matej


 Johan Compagner wrote:
  first of all we are talking about 2 problems here!
 
  Matej's and Laurent problems are completely different.
 
  I still believe that Matej should use a temp model (in between model)
  And the validations shouldn't be on the component level but between the
  between model and the real (strong typed) model.
  I 

Re: [Wicket-user] Preserve form state

2005-11-17 Thread Johan Compagner
it is not really a model in what you normally call a model.
Now you are holding everything in those attributes
What is then then? That is also a model but integrated into the form'
I find that a bit uglier..

What kind of validation/feedback issues would you have?
I don;t think anything will really change in the validation and or feedback.
On 11/17/05, Matej Knopp [EMAIL PROTECTED] wrote:
Well, having to do validation in model seems like a step backwards fromwhat I have now. There are already validators that can be attached toobjects, no to mention, that I would have issues with feedback, etc.
I still don't think layered model is a way to go. Currently, I have asolution, that works well form me. But it has two drawbacks.1. It's really hacky.2. It uses the invalidInput property of form components to store
temporary values. When clicking on an ImmediateButton, all formcomponents are marked invalid (so that they remember the values ininvalidInput) and all feedbackMessages are supressed. So after clickingimmediateButton, all feedback messages are hidden (even the valid one).
The advantages are that validation works as usual.I'm attaching the source code in case anyone needs this. It seems thatthis behavior (not implementation) won't have enough support to get intowicket.
-MatejJohan Compagner wrote: first of all we are talking about 2 problems here! Matej's and Laurent problems are completely different. I still believe that Matej should use a temp model (in between model)
 And the validations shouldn't be on the component level but between the between model and the real (strong typed) model. I really believe this is the best way. Any thing i can currently think of will result in something like that anyway.. The values Need to be
 stored somewhere!! So having something like a model: Model(Model realModel) { Hashmap values; getObject(Component comp)return values.get(comp);
 setObject(Component comp, Object value) values.put(comp, value);public void saveToReal(){ Object realObject = realModel.getObject(null); while( Iterate over the values maps keys)
 Component key; String stringValue;
Object value = converter.convertToType(stringValue);
validator.validate(key,value)
String id = key.getId() // or get some kind of binding see BoundedCompoundPropertyModel
Objects.setValue(id,realObject,value,null);} } this is just a rought idea how a in between model should or could work. Laurents problem is completely different, He doesn't want to hold the
 data (and do nothing with it) over multiply pages. He just wants portions to be validated and portions to be kept for one request only but not validated. I think this is now already possible with the
 Button.defaultFormProcessing boolean Then the buttons must have a list of components which he must be validated before he does process everything. then he can call FormComponent.validate() and if that goes ok
 FormComponent.updateModel() (and so on on the complete List) I think we are then where we are. You just need a special button that has a list of FormComponents to be validated...
 On 11/16/05, *Johan Compagner* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
 i still think in youre case you have to use a inbetween model There is no other way. Even if we stored it inside the form itself then that is the inbetween model And i don't know if i want to support that.
 On 11/16/05, *Matej Knopp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  wrote:
 Hi. The problem is, that I don't want to validate the form, unless user clicks 'OK'. The model is updated after validation only. But the 'choose' button should NOT validate the form.
 I don't think it's a good thing storing the temporary values in model (at least in my case), because model is typed. The temporary values should only be strings (get from Http request).
 -Matej Johan Compagner wrote:Just one extra remark.Why can't use just use a model for this?And that model is an in between model for you real model object?
Ok you have to do youre validation a bit different(it can't be betweenForm-Modelbut it has to be between TmpModel-RealModelThis looks to me like a much better way to have multiply page
 forms...johanOn 11/13/05, *Matej Knopp*  [EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi.
 I know this has been discussed already, but still I'm opening it once more. I think there should be a way to preserve form state without validation and model updating.
 The use case is following. I have a (complex) form with some fields, that can not be entered directly, i.e. they have to be selected on other page. So I
 need to move between pages, but I don't want to lose any information entered on the previous page. If I use Button, the form gets processed, validated, etc
 and the action won't execute unless all entered data is valid. If I turn defaultProcessing off, the action executes, but the data (not written to model yet) is lost.
 What I'm using now is little hacky, but it works. I 

Re: [Wicket-user] Preserve form state

2005-11-17 Thread Johan Compagner
youre SmartForms are just what i described as and Array/List inside a button
so that a button knows what to valdate when it gets pressed.
On 11/17/05, Laurent PETIT [EMAIL PROTECTED] wrote:
Thanks a lot for having sent the source code.I'll check it ASAP (but not before next week, I fear), because I'm*very* interested in encapsulating the behaviour you're talking aboutin a reusable package.
I already have some ideas under the cover, but I'm far to having goodknowledges of Wicket internals, and I guess your code will help medelve into those internals.In short, my idea, if feasible, would be to create a kind of
SmartForm that could be a border around other FormComponents, andeven embed other SmartForms.And a SmartForm validation will be bound to a set of Buttons/Actionsexplicitly added to the SmartForm using something like
SmartForm.validateOnButton/Action(Button/Action).And you could also cascade validation : if a SmartForm b is embeddedin another SmartForm a, you can choose on the SmartForm b if
validation of the parent SmartForm (a) will cascade the validationto the SmartForm b.So you then have a SmartForm b, attached to a validation buttonbButton, and the SmartForm a, attached to a validation button
aButtonIf b declares that validations cascade through it, then thefollowing use cases will be as follows :- user presses bButton : only the validations of the b SmartForm
are done (and also updates of the b models). The values entered bythe user on the other formComponents of the a SmartForm arepreserved (and here your code is of some interest to me).
- user presses aButton : the validation occurs on all theformComponents inside the a SmartForm, and also on all theSmartForms that accept validation cascading, so formComponents of b
SmartForm are also validated.Another interesting use case that is solved by this solution is theuse case where in the same form you have some formComponents neededfor the creation of something, and associated to a Create Button,
and some other formComponents that display the contents of (editable)already created somethings (for bulk updates).Then you create 2 SmartForms : one SmartForm (lets call itcreateForm) for the formComponents needed when the user hits the
Create Button (that then *need* to be validated), and one SmartFormfor the formComponents of the rest of the page (lets call itupdateForm, and say that it's bound to the global submit button of
the page).And to end the settings of your components, you call somecreateForm.setCascadeValidation(false).Then when the global submit button of the page is called on the globalupdateForm, if the createForm is embedded in the updateForm,
then validation will not occur on the createForm SmartForm (andthat's good !).A last interesting use case for this :in all the pages of you application, you have a little box that allows
the user to sign in.A user hits a page where he can enter some values in some fields. Andbefore validating the page, he decides to log in. What I want is thatafter having logged in, the page still presents the values entered in
its body by the user.So the need to :- have a single form for all the data of the page- use a concept like my SmartForm in order to separate theformComponents dedicated to the user login action (presumably
login/password :-) from the formComponents of the main purpose of thepage at hand (some blog entry formComponents, ... whatever ...).Without the use of a concept like SmartForms and changes in Componentsas those mentioned by Matej, it will be very difficult, verbose, and
error prone to have this *simple* and *basic* (user friendly centered)behaviour on all the pages of an application ...But yet, it is still all in my head, I have nothing to present yet(but I hope it will come soon).
My 0,05 EUR, :-)--LaurentOn 11/17/05, Matej Knopp [EMAIL PROTECTED] wrote: Well, having to do validation in model seems like a step backwards from
 what I have now. There are already validators that can be attached to objects, no to mention, that I would have issues with feedback, etc. I still don't think layered model is a way to go. Currently, I have a
 solution, that works well form me. But it has two drawbacks. 1. It's really hacky. 2. It uses the invalidInput property of form components to store temporary values. When clicking on an ImmediateButton, all form
 components are marked invalid (so that they remember the values in invalidInput) and all feedbackMessages are supressed. So after clicking immediateButton, all feedback messages are hidden (even the valid one).
 The advantages are that validation works as usual. I'm attaching the source code in case anyone needs this. It seems that this behavior (not implementation) won't have enough support to get into
 wicket. -Matej Johan Compagner wrote:  first of all we are talking about 2 problems here!   Matej's and Laurent problems are completely different.
   I still believe that Matej should use a temp model (in between model)  And the validations shouldn't be 

Re: [Wicket-user] Preserve form state

2005-11-17 Thread Matej Knopp
Okay, so if I understand you correctly, you suggest changing default 
form processing like this?

 - immediate button submitted:
validate();
if (hasError(); {
markFormComponentsInvalid();
onError();
}
updateFormComponentsFakeModel();
 // this is executed even if form has Error. But the model of all
 // components has to be a special two layer model and must know
 // whether to update the real model or only the fake model.

This seems doable, the little complication I'm aware of is to ensure 
that all form components are having this special model.



Another thing is that maybe two kind of model wrappers will be needed. 
One implementing ICompoundModel and one not. I'm not quite sure here.


Say you have a form and set it's model to something like 
DoubleLayerCompoundModelWrapper. (it's a wrapper implementing 
ICompoundModel).


All form components will inherit it. So far, so good. But if I have a 
form component with it's own model (say PropertyModel), could I just 
wrap the model with DoubleLayerCompoundModelWrapper too, even if it's 
not compound model?


-Matej

Johan Compagner wrote:

it is not really a model in what you normally call a model.
Now you are holding everything in those attributes
What is then then? That is also a model but integrated into the form'
I find that a bit uglier..
It's not the nicest solution, I'm quite aware of that. Therefore this 
thread.



What kind of validation/feedback issues would you have?
I don;t think anything will really change in the validation and or feedback.


On 11/17/05, *Matej Knopp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

Well, having to do validation in model seems like a step backwards from
what I have now. There are already validators that can be attached to
objects, no to mention, that I would have issues with feedback, etc.

I still don't think layered model is a way to go. Currently, I have a
solution, that works well form me. But it has two drawbacks.

1. It's really hacky.

2. It uses the invalidInput property of form components to store
temporary values. When clicking on an ImmediateButton, all form
components are marked invalid (so that they remember the values in
invalidInput) and all feedbackMessages are supressed. So after clicking
immediateButton, all feedback messages are hidden (even the valid one).

The advantages are that validation works as usual.

I'm attaching the source code in case anyone needs this. It seems that
this behavior (not implementation) won't have enough support to get into
wicket.

-Matej


Johan Compagner wrote:
  first of all we are talking about 2 problems here!
 
  Matej's and Laurent problems are completely different.
 
  I still believe that Matej should use a temp model (in between
model)
  And the validations shouldn't be on the component level but
between the
  between model and the real (strong typed) model.
  I really believe this is the best way. Any thing i can currently
think
  of will result in something like that anyway.. The values Need to be
  stored somewhere!!
  So having something like a model:
 
  Model(Model realModel)
  {
  Hashmap values;
 
  getObject(Component comp)  return values.get(comp);
  setObject(Component comp, Object value) values.put(comp, value);
 
 public void saveToReal()
 {
 
  Object realObject = realModel.getObject(null);
 
  while( Iterate over the values maps keys)
  Component key;
  String stringValue;
  Object value = converter.convertToType(stringValue);
  validator.validate(key,value)
  String id = key.getId() // or get some kind of
binding
  see BoundedCompoundPropertyModel
  Objects.setValue(id,realObject,value,null);
 }
  }
 
  this is just a rought idea how a in between model should or could
work.
 
 
  Laurents problem is completely different, He doesn't want to hold
the
  data (and do nothing with it) over multiply pages.
  He just wants portions to be validated and portions to be kept
for one
  request only but not validated.
  I think this is now already possible with the
  Button.defaultFormProcessing boolean
  Then the buttons must have a list of components which he must be
  validated before he does process everything.
  then he can call FormComponent.validate() and if that goes ok
  FormComponent.updateModel() (and so on on the complete List)
 
  I think we are then where we are. You just need a special button that
  has a list of FormComponents to be validated...
 
 
 
  On 11/16/05, *Johan Compagner* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
  

Re: [Wicket-user] Preserve form state

2005-11-17 Thread Johan Compagner
why use a non default process button? (immediate?)
If you have a in between model then all youre buttons can just be normal once that just doe simple validation (or non)
to the in between model
Then have one (or more) buttons that knows about that in between model
And if that button is pressed it calls a method like processModel() on the inbetween model
Then that model will do the real validation and pushes data to the real model (just like form does now)
All feedback can still be set then if something goes wrong. I don't see a problem doing that or do i miss something?

I still think that this is for youre specific case a pretty clean solution. But maybe i am missing something.

johan
On 11/17/05, Matej Knopp [EMAIL PROTECTED] wrote:
Okay, so if I understand you correctly, you suggest changing defaultform processing like this?- immediate button submitted: validate(); if (hasError(); {markFormComponentsInvalid();
onError(); } updateFormComponentsFakeModel();// this is executed even if form has Error. But the model of all// components has to be a special two layer model and must know
// whether to update the real model or only the fake model.This seems doable, the little complication I'm aware of is to ensurethat all form components are having this special model.
Another thing is that maybe two kind of model wrappers will be needed.One implementing ICompoundModel and one not. I'm not quite sure here.Say you have a form and set it's model to something like
DoubleLayerCompoundModelWrapper. (it's a wrapper implementingICompoundModel).All form components will inherit it. So far, so good. But if I have aform component with it's own model (say PropertyModel), could I just
wrap the model with DoubleLayerCompoundModelWrapper too, even if it'snot compound model?-MatejJohan Compagner wrote: it is not really a model in what you normally call a model.
 Now you are holding everything in those attributes What is then then? That is also a model but integrated into the form' I find that a bit uglier..It's not the nicest solution, I'm quite aware of that. Therefore this
thread. What kind of validation/feedback issues would you have? I don;t think anything will really change in the validation and or feedback. On 11/17/05, *Matej Knopp* 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Well, having to do validation in model seems like a step backwards from what I have now. There are already validators that can be attached to
 objects, no to mention, that I would have issues with feedback, etc. I still don't think layered model is a way to go. Currently, I have a solution, that works well form me. But it has two drawbacks.
 1. It's really hacky. 2. It uses the invalidInput property of form components to store temporary values. When clicking on an ImmediateButton, all form components are marked invalid (so that they remember the values in
 invalidInput) and all feedbackMessages are supressed. So after clicking immediateButton, all feedback messages are hidden (even the valid one). The advantages are that validation works as usual.
 I'm attaching the source code in case anyone needs this. It seems that this behavior (not implementation) won't have enough support to get into wicket. -Matej
 Johan Compagner wrote: first of all we are talking about 2 problems here! Matej's and Laurent problems are completely different.
 I still believe that Matej should use a temp model (in between model) And the validations shouldn't be on the component level but between the between model and the real (strong typed) model.
 I really believe this is the best way. Any thing i can currently think of will result in something like that anyway.. The values Need to be stored somewhere!!
 So having something like a model: Model(Model realModel) { Hashmap values;
getObject(Component comp)return values.get(comp);
setObject(Component comp, Object value) values.put(comp, value);public void saveToReal(){
Object realObject = realModel.getObject(null);
while( Iterate over the values maps keys)
Component key;
String stringValue;
Object value = converter.convertToType(stringValue);
validator.validate(key,value)
String id = key.getId() // or get some kind of binding see BoundedCompoundPropertyModel
Objects.setValue(id,realObject,value,null);} } this is just a rought idea how a in between model should or could work.
 Laurents problem is completely different, He doesn't want to hold the data (and do nothing with it) over multiply pages. He just wants portions to be validated and portions to be kept
 for one request only but not validated. I think this is now already possible with the Button.defaultFormProcessing boolean Then the buttons must have a list of components which he must be
 validated before he does process everything. then he can call FormComponent.validate() and if that goes ok FormComponent.updateModel() (and so on on the complete List)
 I think we are then where we are. You just need a special button that has a list of FormComponents to be 

Re: [Wicket-user] Preserve form state

2005-11-17 Thread Matej Knopp

Because I want form components to do the validation, not the model.
I want the form code to be as close to an ordinary wicket form as 
possible. That means that components themselves do the validation, not 
the model.


If I used the default process button, the action (like showing Choose 
screen) wouldn't be executed unless all entered data is valid.


It seems that I will play a little with the idea of double layer models 
and see, if it's better than my current solution.


-Matej

Johan Compagner wrote:

why use a non default process button? (immediate?)
If you have a in between model then all youre buttons can just be normal 
once that just doe simple validation (or non)

to the in between model
Then have one (or more) buttons that knows about that in between model
And if that button is pressed it calls a method like processModel() on 
the inbetween model
Then that model will do the real validation and pushes data to the real 
model (just like form does now)
All feedback can still be set then if something goes wrong. I don't see 
a problem doing that or do i miss something?


I still think that this is for youre specific case a pretty clean 
solution. But maybe i am missing something.


johan


On 11/17/05, *Matej Knopp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

Okay, so if I understand you correctly, you suggest changing default
form processing like this?
  - immediate button submitted:
 validate();
 if (hasError(); {
markFormComponentsInvalid();
onError();
 }
 updateFormComponentsFakeModel();
  // this is executed even if form has Error. But the model of all
  // components has to be a special two layer model and must know
  // whether to update the real model or only the fake model.

This seems doable, the little complication I'm aware of is to ensure
that all form components are having this special model.


Another thing is that maybe two kind of model wrappers will be needed.
One implementing ICompoundModel and one not. I'm not quite sure here.

Say you have a form and set it's model to something like
DoubleLayerCompoundModelWrapper. (it's a wrapper implementing
ICompoundModel).

All form components will inherit it. So far, so good. But if I have a
form component with it's own model (say PropertyModel), could I just
wrap the model with DoubleLayerCompoundModelWrapper too, even if it's
not compound model?

-Matej

Johan Compagner wrote:
  it is not really a model in what you normally call a model.
  Now you are holding everything in those attributes
  What is then then? That is also a model but integrated into the form'
  I find that a bit uglier..
It's not the nicest solution, I'm quite aware of that. Therefore this
thread.

  What kind of validation/feedback issues would you have?
  I don;t think anything will really change in the validation and
or feedback.
 
 
  On 11/17/05, *Matej Knopp*  [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
 
  Well, having to do validation in model seems like a step
backwards from
  what I have now. There are already validators that can be
attached to
  objects, no to mention, that I would have issues with
feedback, etc.
 
  I still don't think layered model is a way to go. Currently,
I have a
  solution, that works well form me. But it has two drawbacks.
 
  1. It's really hacky.
 
  2. It uses the invalidInput property of form components to store
  temporary values. When clicking on an ImmediateButton, all form
  components are marked invalid (so that they remember the
values in
  invalidInput) and all feedbackMessages are supressed. So
after clicking
  immediateButton, all feedback messages are hidden (even the
valid one).
 
  The advantages are that validation works as usual.
 
  I'm attaching the source code in case anyone needs this. It
seems that
  this behavior (not implementation) won't have enough support
to get into
  wicket.
 
  -Matej
 
 
  Johan Compagner wrote:
first of all we are talking about 2 problems here!
   
Matej's and Laurent problems are completely different.
   
I still believe that Matej should use a temp model (in between
  model)
And the validations shouldn't be on the component level but
  between the
between model and the real (strong typed) model.
I really believe this is the best way. Any thing i can
currently
  think
of will result in something like that anyway.. The values
Need to be
stored somewhere!!
So 

Re: [Wicket-user] Preserve form state

2005-11-17 Thread Laurent PETIT
On 11/17/05, Johan Compagner [EMAIL PROTECTED] wrote:
 youre SmartForms are just what i described as and Array/List inside a
 button
  so that a button knows what to valdate when it gets pressed.

Certainly, it is an attempt to generalize this solution. But you're
not fair when you say that it is just the same.

I'll try to code some things and then come back to the list with it.

I would like to be able to have such functionality by coding this as a
SmartForm user:
MyPage.html

form wicket:id=globalForm ..
  !-- Login logical form --
  span wicket:id=loginForm
input type=text wicket:id=login/
input type=password wicket:id=password/
...
input type=button wicket:id=loginButton/
  /span

  !-- Search logical form --
  span wicket:id=searchForm
input type=text wicket:id=searchCriteria/
input type=button wicket:id=searchButton/
  /span

  !-- Main body logical form --
  input type=text wicket:id=globalField/
  ...
  input type=button wicket:id=globalButton/
/form

MyPage.java
MyPage() {
  
  SmartForm globalForm = new SmartForm(globalForm);
  add(globalForm);
  SmartForm loginForm = new SmartForm(loginForm);
  add(loginForm);
  SmartForm searchForm = new SmartForm(searchForm);
  add(searchForm);

  // ... form configuration as usual, maybe use a CompoundPropertyModel ...
  loginForm.add(new TextField(login));
  loginForm.add(new TextField(password));
  loginForm.add(new Button(loginButton, Log In));

  // Indicate that the loginForm will not participate in the Global
Form validation process
  // So just the loginButton will have a validation/model update
action on the loginForm
  loginForm.setPropagateValidation(false);

  // ... same for search Form
  searchForm.add(new TextField(searchCriteria));
  searchForm.add(new Button(searchButton), Search);
  // SearchForm do not participate in global validation
  searchForm.setPropagateValidation(false);

  // Main page form
  globalForm.add(new TextField(globalField));
  ...
  globalForm.add(new Button(globalButton, Submit page entries);
}


This would allow great validation units of work power, while keeping
it as simple as it is now for common use cases.

What do you think about it ?


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-17 Thread Eelco Hillenius
It would be nice if this thread ended up with some recommendations on
how the (default) form processing itself might be enhanced in order to
support complex validation/ model updating.

Just a note to say that it's okay to send in patches that touch wicket-core :)

Eelco


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-17 Thread Johan Compagner
do you really want that seperating also in the html?
(with all those spans?)

Looking at youre example and guessing what the smartform (and the button in it does) 
IT is the same, the smart form is just the holder of the components just as i said my List object inside a button would be.
It is just a bit different composition of things.

I do see something in this (don't know how manu people would really use this but it would be nice)
What i don't like is that you also has to specify it in html. I would like to do that pure in java.
(so a smart form is not a Wicket component)

johan

On 11/17/05, Laurent PETIT [EMAIL PROTECTED] wrote:
On 11/17/05, Johan Compagner [EMAIL PROTECTED] wrote: youre SmartForms are just what i described as and Array/List inside a buttonso that a button knows what to valdate when it gets pressed.
Certainly, it is an attempt to generalize this solution. But you'renot fair when you say that it is just the same.I'll try to code some things and then come back to the list with it.I would like to be able to have such functionality by coding this as a
SmartForm user:MyPage.htmlform wicket:id=globalForm ..!-- Login logical form --span wicket:id=loginForminput type=text wicket:id=login/
input type=password wicket:id=password/...input type=button wicket:id=loginButton//span!-- Search logical form --
span wicket:id=searchForminput type=text wicket:id=searchCriteria/input type=button wicket:id=searchButton//span
!-- Main body logical form --input type=text wicket:id=globalField/...input type=button wicket:id=globalButton/
/formMyPage.javaMyPage() {SmartForm globalForm = new SmartForm(globalForm);add(globalForm);SmartForm loginForm = new SmartForm(loginForm);add(loginForm);
SmartForm searchForm = new SmartForm(searchForm);add(searchForm);// ... form configuration as usual, maybe use a CompoundPropertyModel ...loginForm.add(new TextField(login));
loginForm.add(new TextField(password));loginForm.add(new Button(loginButton, Log In));// Indicate that the loginForm will not participate in the GlobalForm validation process
// So just the loginButton will have a validation/model updateaction on the loginFormloginForm.setPropagateValidation(false);// ... same for search FormsearchForm.add(new TextField(searchCriteria));
searchForm.add(new Button(searchButton), Search);// SearchForm do not participate in global validationsearchForm.setPropagateValidation(false);// Main page formglobalForm.add
(new TextField(globalField));...globalForm.add(new Button(globalButton, Submit page entries);}This would allow great validation units of work power, while keeping
it as simple as it is now for common use cases.What do you think about it ?---This SF.Net email is sponsored by the JBoss Inc.Get Certified Today
Register for a JBoss Training Course.Free Certification Examfor All Training Attendees Through End of 2005. For more info visit:http://ads.osdn.com/?ad_idv28alloc_id845opclick
___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-17 Thread Laurent PETIT
On 11/17/05, Johan Compagner [EMAIL PROTECTED] wrote:
 do you really want that seperating also in the html?
  (with all those spans?)

No, not sure it's what I definitely want, I'm still in the
brainstorming process, as I said.

  Looking at youre example and guessing what the smartform (and the button in
 it does)
  IT is the same, the smart form is just the holder of the components just as
 i said my List object inside a button would be.
  It is just a bit different composition of things.

Yes, it is some kind of holder with some interesting behaviour.
As a Wicket component, I thought that it was cool that this
component can decide if it wants to participate to the current
validation or not, based on the propagateValidation flag and on the
button(s)/action(s) that triggered the global/real html form submit.

  I do see something in this (don't know how manu people would really use
 this but it would be nice)
  What i don't like is that you also has to specify it in html. I would like
 to do that pure in java.
  (so a smart form is not a Wicket component)

I understand that SmartForm is not directly bound to an html item, but
I wanted it to be like a Border ... so that it has the power to
participate in the standard validation / rendering flow.

I think we definitely arrive at the time where I have to suggest some
code base (be it a patch toward the core, or some Components
extensions, or a mix of the two with, as Eelco suggests, a patch
toward core that could provide hooks to do the rest in third party
libraries ...)

Hope this will come soon,

--
Laurent


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-17 Thread Laurent PETIT
OK, now I have a first attempt to submit.

It is what could be considered as a cleaner way to address Matej's
initial problem.
But it is a hack to the core, so it's normal that I've come up with
something cleaner I think.

And as it's a modification to the core, it's also more error-prone.

It is too late tonight for me to explain what I did, so please for the
moment take a look at the 2 new classes versions :

wicket.markup.html.form.Form
wicket.markup.html.form.FormComponent

or the diffs files if you prefer.

And I've joined 2 very basic test files (markup  class)

In short : in the new version, on formSubmitted(), child form
components are told that a new user input is available (method
FormComponent.newUserInputAvailable()).
In this method, the FormComponent stores the user input in a rawInput field.
This rawInput is then available for re-rendering for both use cases :
when data is invalid and when model is not up to date (for example
when returning from another page as in Matej's use case, the form will
be rendered again with the rawInput, and not the model).

You can see that it also frees the FormComponent code from the weird
NO_INVALID_INPUT constant (by using a modelUpToDate boolean field)

Fiuu, time to sleep now ! :-)

regards,

--
laurent


Form.java.diff
Description: Binary data


Form.java
Description: Binary data


FormComponent.java
Description: Binary data


FormComponent.java.diff
Description: Binary data


Re: [Wicket-user] Preserve form state

2005-11-17 Thread Laurent PETIT
Whoops, the missing test files in attachment ... :-)

On 11/18/05, Laurent PETIT [EMAIL PROTECTED] wrote:
 OK, now I have a first attempt to submit.

 It is what could be considered as a cleaner way to address Matej's
 initial problem.
 But it is a hack to the core, so it's normal that I've come up with
 something cleaner I think.

 And as it's a modification to the core, it's also more error-prone.

 It is too late tonight for me to explain what I did, so please for the
 moment take a look at the 2 new classes versions :

 wicket.markup.html.form.Form
 wicket.markup.html.form.FormComponent

 or the diffs files if you prefer.

 And I've joined 2 very basic test files (markup  class)

 In short : in the new version, on formSubmitted(), child form
 components are told that a new user input is available (method
 FormComponent.newUserInputAvailable()).
 In this method, the FormComponent stores the user input in a rawInput field.
 This rawInput is then available for re-rendering for both use cases :
 when data is invalid and when model is not up to date (for example
 when returning from another page as in Matej's use case, the form will
 be rendered again with the rawInput, and not the model).

 You can see that it also frees the FormComponent code from the weird
 NO_INVALID_INPUT constant (by using a modelUpToDate boolean field)

 Fiuu, time to sleep now ! :-)

 regards,

 --
 laurent





Form.java.diff
Description: Binary data


Form.java
Description: Binary data


FormComponent.java
Description: Binary data


FormComponent.java.diff
Description: Binary data
Title: Wicket SmartForms Test Page




 

 
 

 
 

 
 
 ...
 
 





TestPage.java
Description: Binary data


TestPage.properties
Description: Binary data


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Laurent PETIT
Hello,

I had some same interrogations as Matej has ...

I'm currently trying to fully reimplement a complex form made in
struts in wicket, and some buttons of the form are there only to
dynamically add elements to a list (doing a roundtrip with the
server), but don't have to trigger the validation stuff.
But that's what's done, and it's a bit annoying.

 Why can't use just use a model for this?

I agree with you, model should be updated, I think at Wicket models as
View models. But the idea of Matej of not immediately storing in the
real model could be a good idea (but not done in the invalid data
field).


What could be great is to register / inform the Form which buttons may
trigger the validators/model updating of the components, and which
buttons may not.

Regards,

--
Laurent


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Johan Compagner
i agree
For a roundtrip so page to the same page with do something i will build that.
For example a onSelectionChangeListener on a DropDown works now through a normal link (a get request)
And that has to work through the form itself. So it has to submit the form, but don't do anything with it
then call the listener for the selection (so the dropdown) then redisplay the form with the values that where submitted.

That is what i want to support/build. I hope to start with it early next week.

But what matej wants is having a form on one page. Then you go to another to get some other data. Then go back
and then still has the right form data in it. But that shouldn't be submitted to any model or validated.
I personally say. Do that with an in between model. And don't do
youre validation in form-model but in inbetween model-real
model

I even think that such a in between model where you can add validators
to for specific properties and have a special submit method on
would be even very nice for the core of wicket.

johan
On 11/16/05, Laurent PETIT [EMAIL PROTECTED] wrote:
Hello,I had some same interrogations as Matej has ...I'm currently trying to fully reimplement a complex form made instruts in wicket, and some buttons of the form are there only todynamically add elements to a list (doing a roundtrip with the
server), but don't have to trigger the validation stuff.But that's what's done, and it's a bit annoying. Why can't use just use a model for this?I agree with you, model should be updated, I think at Wicket models as
View models. But the idea of Matej of not immediately storing in thereal model could be a good idea (but not done in the invalid datafield).What could be great is to register / inform the Form which buttons may
trigger the validators/model updating of the components, and whichbuttons may not.Regards,--Laurent---This SF.Net email is sponsored by the JBoss Inc.Get Certified Today
Register for a JBoss Training Course.Free Certification Examfor All Training Attendees Through End of 2005. For more info visit:http://ads.osdn.com/?ad_idv28alloc_id845opclick
___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Laurent PETIT
Hello,

 I personally say. Do that with an in between model. And don't do youre
 validation in form-model but in inbetween model-real model

I may be wrong, but this really makes me think we are reinventing
Struts Forms-like beans with this in between model.

Indeed, all input type=text fields should in the in between model
be strings because the model will be updated without any check, ,
not sure this is the right pattern to implement ...


Difficult area ...

--
Laurent


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Johan Compagner
this also can be completely build into form itself.
But then i think a separation looks/smells better.. 
But i am open to any idea's !

johan
On 11/16/05, Laurent PETIT [EMAIL PROTECTED] wrote:
Hello, I personally say. Do that with an in between model. And don't do youre validation in form-model but in inbetween model-real modelI may be wrong, but this really makes me think we are reinventing
Struts Forms-like beans with this in between model.Indeed, all input type=text fields should in the in between modelbe strings because the model will be updated without any check, ,
not sure this is the right pattern to implement ...Difficult area ...--Laurent---This SF.Net email is sponsored by the JBoss Inc.Get Certified Today
Register for a JBoss Training Course.Free Certification Examfor All Training Attendees Through End of 2005. For more info visit:http://ads.osdn.com/?ad_idv28alloc_id845opclick
___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Alexandru Popescu

Matej's scenario looks to me very much like a 'wizard' or even more generalized 
as a flow.

Most probably the generic scenario sounds like:
1/ on each page do validate the page input and persist the state
2/ on the end page validate the whole input

WebWork has added support for something similar by incorporating rife-continuations. Unfortunately 
my knowledge about continuations and rife is reduced, so I cannot further comment.


hth,

./alex
--
.w( the_mindstorm )p.


#: Matej Knopp changed the world a bit at a time by saying on  11/13/2005 3:04 
AM :#

Hi.

I know this has been discussed already, but still I'm opening it once 
more. I think there should be a way to preserve form state without 
validation and model updating.


The use case is following.
I have a (complex) form with some fields, that can not be entered 
directly, i.e. they have to be selected on other page. So I need to move 
between pages, but I don't want to lose any information entered on the 
previous page. If I use Button, the form gets processed, validated, etc 
and the action won't execute unless all entered data is valid. If I turn 
defaultProcessing off, the action executes, but the data (not written to 
model yet) is lost.


What I'm using now is little hacky, but it works. I have my own class 
derived from Form, my own SubmitButton, ImmediateButton and 
FeedbackPanel. ImmediateButton acts like classic Button with 
defaultFormProcessing turned off, but unlike it, ImmediateButton stores 
the state in each component (in the string reserved for invalid data). 
So there's my own Feedback panel (Although filter would be probably 
enough) that detects that ImmediateButton was clicked and hides 
validation messages (there's a lot of them, because ImmediateButton 
marks every component as invalid).


This approach works pretty well, but doesn't feel quite right. I think 
there definitely should be a way to preserve form state (without 
validation and updating model) directly supported by wicket.
Not to mention that (if I recall correctly) the string field in 
FormComponent used for storing invalid data is transient.


Btw. I've managed to persuade people from my company to use wicket for 
one of our projects. Since I do most of the current development, it's 
not a big deal, because I've personally been using wicket for some time 
now. But I can say they are really impressed with the productivity and 
simplicity of certain actions (like moving between complex pages forth 
and back ;) - that are sometimes quite difficult and cumbersome in struts.
Not to mention excellent DataView and DatePicker components, markup 
inheritance and compoents in general.


Kudos wicket team, you're doing excelent work!

Sorry for really long mail,

-Matej


---
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42 plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Laurent PETIT
On 11/16/05, Johan Compagner [EMAIL PROTECTED] wrote:
 this also can be completely build into form itself.
 But then i think a separation looks/smells better..
 But i am open to any idea's !

For me, the problem arises when you have a hierarchical model, and
when you can edit in the same time values at multi-levels.

For example (keeping it simple) :
a Monkey holds bananas.
The page displays the list of Monkeys, with editable field for the age
(numeric), and a label for the name (non editable) of the Monkey.
And for each Monkey, its bananas are displayed, with a description
and weight field for each banana.

The page also displays a New Monkey button that creates a new
Monkey, grabs its name from a textfield (must not be null) and adds
the new monkey (with default age and no bananas) at the end of the
monkey list.

The page also displays a New banana per monkey, and a Delete
banana for each banana of each monkey.

And finally, the page has a global submit button.

Use cases :
uc1 :I want the user to be able to create a new monkey without
triggering the validation and model update of the other monkeys and
bananas fields.
uc2 : When the user creates a monkey, the monkey name textfield is
used to create some identifier for the monkey. This field is only
needed for the creation of a new monkey : it is Required when
clicking the New Monkey button. The name textfield is only
concerned by the New banana button, and does not have to validate
itself and block the process if empty, when the user presses the
global submit button.

What is really needed here is many multiple unit of work forms in the
same page, but contrary to the behaviour of the HTML form element, I
don't want to loose the user input on the other forms.

Not sure if it is clear, if not, I can maybe write a template html
page to show the page I'm talking about.

Please note that here I don't address the whole problem as suggested
by Matej, since my scenario didn't describe a form that may span
many Wicket pages ...

--
laurent


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Johan Compagner
I think youre usecases can be build now with the current code base.

uc1: that new button should be an immediant button (this is a property) then the model values are not processed.
uc2: you just have to validate this in the button i talked above (if text field is filled in yes or no)

johan
On 11/16/05, Laurent PETIT [EMAIL PROTECTED] wrote:
On 11/16/05, Johan Compagner [EMAIL PROTECTED] wrote: this also can be completely build into form itself. But then i think a separation looks/smells better..
 But i am open to any idea's !For me, the problem arises when you have a hierarchical model, andwhen you can edit in the same time values at multi-levels.For example (keeping it simple) :
a Monkey holds bananas.The page displays the list of Monkeys, with editable field for the age(numeric), and a label for the name (non editable) of the Monkey.And for each Monkey, its bananas are displayed, with a description
and weight field for each banana.The page also displays a New Monkey button that creates a newMonkey, grabs its name from a textfield (must not be null) and addsthe new monkey (with default age and no bananas) at the end of the
monkey list.The page also displays a New banana per monkey, and a Deletebanana for each banana of each monkey.And finally, the page has a global submit button.Use cases :
uc1 :I want the user to be able to create a new monkey withouttriggering the validation and model update of the other monkeys andbananas fields.uc2 : When the user creates a monkey, the monkey name textfield is
used to create some identifier for the monkey. This field is onlyneeded for the creation of a new monkey : it is Required whenclicking the New Monkey button. The name textfield is only
concerned by the New banana button, and does not have to validateitself and block the process if empty, when the user presses theglobal submit button.What is really needed here is many multiple unit of work forms in the
same page, but contrary to the behaviour of the HTML form element, Idon't want to loose the user input on the other forms.Not sure if it is clear, if not, I can maybe write a template html
page to show the page I'm talking about.Please note that here I don't address the whole problem as suggestedby Matej, since my scenario didn't describe a form that may spanmany Wicket pages ...
--laurent---This SF.Net email is sponsored by the JBoss Inc.Get Certified TodayRegister for a JBoss Training Course.Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:http://ads.osdn.com/?ad_idv28alloc_id845opclick___
Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user



Re: [Wicket-user] Preserve form state

2005-11-16 Thread Laurent PETIT
Hello,

 I think youre usecases can be build now with the current code base.
 uc1: that new button should be an immediant button (this is a property) then
 the model values are not processed.

By the time, I don't really understand the immediant term, doesn't
seem to be an english term at all (trusting my dictionary).

 uc2: you just have to validate this in the button i talked above (if text
 field is filled in yes or no)

What I don't like in this solution is that it is not general enough :
I can not benefit from the out of the box first level Validators for
validating the monkey name : what if I need some pattern matching, or
if it must be an Integer, ...

What I would prefer, and that could be more general, would be a mean
to associate the validation (and model updating !) of some parts of
the form to the general form submitting buttons, ... and associating
other parts of the form to other actions. Thus being able to group
area of concerns ...


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Matej Knopp

Hi.

The problem is, that I don't want to validate the form, unless user 
clicks 'OK'. The model is updated after validation only. But the 
'choose' button should NOT validate the form.


I don't think it's a good thing storing the temporary values in model 
(at least in my case), because model is typed. The temporary values 
should only be strings (get from Http request).


-Matej

Johan Compagner wrote:

Just one extra remark.
Why can't use just use a model for this?
And that model is an in between model for you real model object?

Ok you have to do youre validation a bit different  (it can't be between 
Form-Model

but it has to be between TmpModel-RealModel

This looks to me like a much better way to have multiply page forms...

johan


On 11/13/05, *Matej Knopp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

Hi.

I know this has been discussed already, but still I'm opening it once
more. I think there should be a way to preserve form state without
validation and model updating.

The use case is following.
I have a (complex) form with some fields, that can not be entered
directly, i.e. they have to be selected on other page. So I need to move
between pages, but I don't want to lose any information entered on the
previous page. If I use Button, the form gets processed, validated, etc
and the action won't execute unless all entered data is valid. If I turn
defaultProcessing off, the action executes, but the data (not written to
model yet) is lost.

What I'm using now is little hacky, but it works. I have my own class
derived from Form, my own SubmitButton, ImmediateButton and
FeedbackPanel. ImmediateButton acts like classic Button with
defaultFormProcessing turned off, but unlike it, ImmediateButton stores
the state in each component (in the string reserved for invalid data).
So there's my own Feedback panel (Although filter would be probably
enough) that detects that ImmediateButton was clicked and hides
validation messages (there's a lot of them, because ImmediateButton
marks every component as invalid).

This approach works pretty well, but doesn't feel quite right. I think
there definitely should be a way to preserve form state (without
validation and updating model) directly supported by wicket.
Not to mention that (if I recall correctly) the string field in
FormComponent used for storing invalid data is transient.

Btw. I've managed to persuade people from my company to use wicket for
one of our projects. Since I do most of the current development, it's
not a big deal, because I've personally been using wicket for some time
now. But I can say they are really impressed with the productivity and
simplicity of certain actions (like moving between complex pages forth
and back ;) - that are sometimes quite difficult and cumbersome in
struts.
Not to mention excellent DataView and DatePicker components, markup
inheritance and compoents in general.

Kudos wicket team, you're doing excelent work!

Sorry for really long mail,

-Matej


---
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download
it for free - -and be entered to win a 42 plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
mailto:Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user






---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Laurent PETIT
On 11/16/05, Matej Knopp [EMAIL PROTECTED] wrote:
 Hi.

 The problem is, that I don't want to validate the form, unless user
 clicks 'OK'. The model is updated after validation only. But the
 'choose' button should NOT validate the form.

 I don't think it's a good thing storing the temporary values in model
 (at least in my case), because model is typed. The temporary values
 should only be strings (get from Http request).

Correct. If we have to deal with strings in temporary models in order
to have such functionalities, it looks like a step back to old struts
formbeans to me.

We should be able to decide which automatic validations (and model
updates) are triggered by which actions (buttons, forms validated by
javascript, general form validation, ...)


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Laurent PETIT
Hello Eelco,

 First of all, let's agree that your use case is not a typical one. We
 shouldn't make core adjustements that would make things easier for 5%
 but harder for 95% of the cases.

Not sure if you're talking about Matej's or mines (a drawback of the
GMail's view ...) ;-)

I still do think that the use case I exposed (with monkeys) is great
to show what could be the limits of the frameworks I test. Wicket is
great at Component composition ? Great ! I have a good old Form
composition problem for it ;-)
And it's actually a problem I had with an old project (but of course
not talking about monkeys and bananas, not that fun ;-), and it was a
pain in the ass to do it cleanly with struts.

I don't understand why you would make things harder for 95% of the
other cases ? I think that simplicity can be combined with proper
default behaviour ?

 Anyway, I think what you want can be done rather elegant now. Like you
 outlined, you should use Button.defaultFormProcessing = false to begin
 with. In your onSubmit methods of these buttons, you can manually
 trigger validation and/ or model updates (e.g. call
 Form.updateFormComponentModels).

Except if I didn't well understand the behaviour of the
defaultFormProcessing flag, I think this would not help in my use case
(if I add a New Banana, I definitely don't want to update the other
models at the same time, while still re-rendering the page with the
current user inputs).

By the time, I'll checkout the HEAD version, since Johan told about an
immediant button. I want to check what this is.


 The next trick is to use models specifically for your view layer, and
 once you're done with your wizard style functionality, combine these
 models into something you really need. You won't loose any input this
 way.

Yes, but you will still lack the automatic field type validation and
conversion, won't you ? Because if I use models, and if I allow users
to temporarily enter bad inputs (such as foo in a numeric
textfield), my (intermediate) model will have to handle only strings.
For all form components then ... (except maybe those from combobox,
radio buttons  checkboxes).
And so, when my complete form is finally submitted, I will have to do
all the validations manually (required, type conversions, ranges,
...). Not so good, is it ?


 Finally, regarding complex validations... As soon as you need to do
 validations that are dependent on other model properties etc, it is
 probably wise to leave the default validation path in Wicket.
 IValidators are very useful for simple validations that are 1-1
 related to components,

Sure, a solution that would imply to abandon even the power of the
wicket-provided IValidators implementations for the (intermediate
model) should be avoided.

 but if you need to do more complex things, they
 are probably more in your way than any help. If you want to do complex
 validations easy, you can do them in onSubmit handler code.

I guess the IValidator should mainly be used for 1-1 validations,
superficial validations such as required, ranges, types, 

 Anyway, I think that when looking whether we can make things easier
 for more complex use cases, we shouldn't be thinking too much about
 how we can ease things automagically, but instead focus on flexibility

i agree, things should remain straightforward for common use cases.
Flexibility should allow to handle more complex use cases by replacing
default behaviour with some other one.

 and - maybe more important as not everyone seems to understand to
 current form processing - clarity of form processing and it's possible
 interception points.

Yes, I'll dive into the code ASAP, so that (I hope so) my next posts
will be more constructive, and not only feature requests ;-)

cu,

--
laurent


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Matej Knopp
I think this is not about updating model nor validating. It's about 
preserving http parameters, that are already sent.


What I want to achieve is that you have kind of immediate button, that 
preserves the form attributes (exactly as they were filled by the user), 
but doesn't update model, nor validates components.


I think it should be handled on component level. Right now, every 
FormComponent has an invalidInput string. I think of something similiar, 
but more general.


If an immediate button (with some attribute like preserveFormState set 
to true) was clicked (or drop down combo changed, etc...), these fields 
well be updated from request attributes. If another request came, 
without attributes, values from these fields would be displayed.

On regular form submit, model would be updated and these fields cleaned.

Right now, it's not quite possible to do it this way, because 
FormComponent.getValue() is final (Is this necessary?).


-Matej



Eelco Hillenius wrote:

On 11/16/05, Laurent PETIT [EMAIL PROTECTED] wrote:


Hello Eelco,



First of all, let's agree that your use case is not a typical one. We
shouldn't make core adjustements that would make things easier for 5%
but harder for 95% of the cases.


Not sure if you're talking about Matej's or mines (a drawback of the
GMail's view ...) ;-)



Matje's.



I don't understand why you would make things harder for 95% of the
other cases ? I think that simplicity can be combined with proper
default behaviour ?



It wouldn't nescesarily be the case. I just wanted to issue a warning
that we shouldn't make things more complex in order to make that 5% a
little bit easier.




Anyway, I think what you want can be done rather elegant now. Like you
outlined, you should use Button.defaultFormProcessing = false to begin
with. In your onSubmit methods of these buttons, you can manually
trigger validation and/ or model updates (e.g. call
Form.updateFormComponentModels).


Except if I didn't well understand the behaviour of the
defaultFormProcessing flag, I think this would not help in my use case
(if I add a New Banana, I definitely don't want to update the other
models at the same time, while still re-rendering the page with the
current user inputs).

By the time, I'll checkout the HEAD version, since Johan told about an
immediant button. I want to check what this is.




Johan referred to 'immediate' which was the name that I gave to the
property that is now defaultFormProcessing. I used immediate because
JSF (and Tapestry?) use that name. But other devs felt
defaultFormProcessing was a better name.

The point of that property is that once you set it off, you can do
form processing in any way you want - or at least that is the idea. So
you can do an update of all models, but you can also do a partial
update if you want. Same goes for validation.




The next trick is to use models specifically for your view layer, and
once you're done with your wizard style functionality, combine these
models into something you really need. You won't loose any input this
way.


Yes, but you will still lack the automatic field type validation and
conversion, won't you ? Because if I use models, and if I allow users
to temporarily enter bad inputs (such as foo in a numeric
textfield), my (intermediate) model will have to handle only strings.
For all form components then ... (except maybe those from combobox,
radio buttons  checkboxes).
And so, when my complete form is finally submitted, I will have to do
all the validations manually (required, type conversions, ranges,
...). Not so good, is it ?



If you are ready for validation, you can call Form.validate manually
or even for each form component you want to validate
FormComponent.validate. You can use FormComponent.isValid and/ or
Form.hasError to see whether that validation got you any errors.



I guess the IValidator should mainly be used for 1-1 validations,
superficial validations such as required, ranges, types, 



Months ago, I worked on a form level validation interface for a couple
of days. But I abandonned it as it made things more complex than it
would actually helped people, and I focussed on openening up form
processing instead.



Yes, I'll dive into the code ASAP, so that (I hope so) my next posts
will be more constructive, and not only feature requests ;-)




That would be good. Patches or concrete improvement suggestions are
always welcome, at least for discussion :)

Eelco


---
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28alloc_id845op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





---

Re: [Wicket-user] Preserve form state

2005-11-16 Thread Johan Compagner
i still think in youre case you have to use a inbetween model
There is no other way. Even if we stored it inside the form itself then that is the inbetween model
And i don't know if i want to support that.

On 11/16/05, Matej Knopp [EMAIL PROTECTED] wrote:
Hi.The problem is, that I don't want to validate the form, unless userclicks 'OK'. The model is updated after validation only. But the'choose' button should NOT validate the form.I don't think it's a good thing storing the temporary values in model
(at least in my case), because model is typed. The temporary valuesshould only be strings (get from Http request).-MatejJohan Compagner wrote: Just one extra remark. Why can't use just use a model for this?
 And that model is an in between model for you real model object? Ok you have to do youre validation a bit different(it can't be between Form-Model but it has to be between TmpModel-RealModel
 This looks to me like a much better way to have multiply page forms... johan On 11/13/05, *Matej Knopp* [EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] wrote: Hi. I know this has been discussed already, but still I'm opening it once more. I think there should be a way to preserve form state without
 validation and model updating. The use case is following. I have a (complex) form with some fields, that can not be entered directly, i.e. they have to be selected on other page. So I need to move
 between pages, but I don't want to lose any information entered on the previous page. If I use Button, the form gets processed, validated, etc and the action won't execute unless all entered data is valid. If I turn
 defaultProcessing off, the action executes, but the data (not written to model yet) is lost. What I'm using now is little hacky, but it works. I have my own class derived from Form, my own SubmitButton, ImmediateButton and
 FeedbackPanel. ImmediateButton acts like classic Button with defaultFormProcessing turned off, but unlike it, ImmediateButton stores the state in each component (in the string reserved for invalid data).
 So there's my own Feedback panel (Although filter would be probably enough) that detects that ImmediateButton was clicked and hides validation messages (there's a lot of them, because ImmediateButton
 marks every component as invalid). This approach works pretty well, but doesn't feel quite right. I think there definitely should be a way to preserve form state (without validation and updating model) directly supported by wicket.
 Not to mention that (if I recall correctly) the string field in FormComponent used for storing invalid data is transient. Btw. I've managed to persuade people from my company to use wicket for
 one of our projects. Since I do most of the current development, it's not a big deal, because I've personally been using wicket for some time now. But I can say they are really impressed with the productivity and
 simplicity of certain actions (like moving between complex pages forth and back ;) - that are sometimes quite difficult and cumbersome in struts. Not to mention excellent DataView and DatePicker components, markup
 inheritance and compoents in general. Kudos wicket team, you're doing excelent work! Sorry for really long mail, -Matej ---
 SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42 plasma tv or your very own
 Sony(tm)PSP.Click here to play: http://sourceforge.net/geronimo.php ___ Wicket-user mailing list
 Wicket-user@lists.sourceforge.net mailto:Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user---
This SF.Net email is sponsored by the JBoss Inc.Get Certified TodayRegister for a JBoss Training Course.Free Certification Examfor All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628alloc_id=16845op=click___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-16 Thread Johan Compagner
first of all we are talking about 2 problems here!

Matej's and Laurent problems are completely different.

I still believe that Matej should use a temp model (in between model)
And the validations shouldn't be on the component level but between the between model and the real (strong typed) model.
I really believe this is the best way. Any thing i can currently think
of will result in something like that anyway.. The values Need to be
stored somewhere!!
So having something like a model:

Model(Model realModel)
{
 Hashmap values;

 getObject(Component comp) return values.get(comp);
 setObject(Component comp, Object value) values.put(comp, value);

 public void saveToReal()
 {

 Object realObject = realModel.getObject(null);

 while( Iterate over the values maps keys)
 Component key;
 String stringValue;

Object value = converter.convertToType(stringValue);
 validator.validate(key,value)

String id = key.getId() // or get some kind of binding see
BoundedCompoundPropertyModel

Objects.setValue(id,realObject,value,null);
 }
}

this is just a rought idea how a in between model should or could work.


Laurents problem is completely different, He doesn't want to hold the data (and do nothing with it) over multiply pages.
He just wants portions to be validated and portions to be kept for one request only but not validated.
I think this is now already possible with the Button.defaultFormProcessing boolean
Then the buttons must have a list of components which he must be validated before he does process everything.
then he can call FormComponent.validate() and if that goes ok FormComponent.updateModel() (and so on on the complete List)

I think we are then where we are. You just need a special button that has a list of FormComponents to be validated...

On 11/16/05, Johan Compagner [EMAIL PROTECTED] wrote:
i still think in youre case you have to use a inbetween model
There is no other way. Even if we stored it inside the form itself then that is the inbetween model
And i don't know if i want to support that.

On 11/16/05, Matej Knopp [EMAIL PROTECTED]
 wrote:
Hi.The problem is, that I don't want to validate the form, unless userclicks 'OK'. The model is updated after validation only. But the'choose' button should NOT validate the form.I don't think it's a good thing storing the temporary values in model
(at least in my case), because model is typed. The temporary valuesshould only be strings (get from Http request).-MatejJohan Compagner wrote: Just one extra remark. Why can't use just use a model for this?
 And that model is an in between model for you real model object? Ok you have to do youre validation a bit different(it can't be between Form-Model but it has to be between TmpModel-RealModel
 This looks to me like a much better way to have multiply page forms... johan On 11/13/05, *Matej Knopp* 
[EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] wrote: Hi. I know this has been discussed already, but still I'm opening it once
 more. I think there should be a way to preserve form state without
 validation and model updating. The use case is following. I have a (complex) form with some fields, that can not be entered directly, i.e. they have to be selected on other page. So I need to move
 between pages, but I don't want to lose any information entered on the previous page. If I use Button, the form gets processed, validated, etc and the action won't execute unless all entered data is valid. If I turn
 defaultProcessing off, the action executes, but the data (not written to model yet) is lost. What I'm using now is little hacky, but it works. I have my own class derived from Form, my own SubmitButton, ImmediateButton and
 FeedbackPanel. ImmediateButton acts like classic Button with defaultFormProcessing turned off, but unlike it, ImmediateButton stores the state in each component (in the string reserved for invalid data).
 So there's my own Feedback panel (Although filter would be probably enough) that detects that ImmediateButton was clicked and hides validation messages (there's a lot of them, because ImmediateButton
 marks every component as invalid). This approach works pretty well, but doesn't feel quite right. I think there definitely should be a way to preserve form state (without validation and updating model) directly supported by wicket.
 Not to mention that (if I recall correctly) the string field in FormComponent used for storing invalid data is transient. Btw. I've managed to persuade people from my company to use wicket for
 one of our projects. Since I do most of the current development, it's not a big deal, because I've personally been using wicket for some time now. But I can say they are really impressed with the productivity and
 simplicity of certain actions (like moving between complex pages forth and back ;) - that are sometimes quite difficult and cumbersome in struts. Not to mention excellent DataView and DatePicker components, markup
 inheritance and compoents in general. Kudos wicket team, you're 

Re: [Wicket-user] Preserve form state

2005-11-15 Thread Johan Compagner
Just one extra remark.
Why can't use just use a model for this?
And that model is an in between model for you real model object?

Ok you have to do youre validation a bit different (it can't be between Form-Model
but it has to be between TmpModel-RealModel

This looks to me like a much better way to have multiply page forms...

johan
On 11/13/05, Matej Knopp [EMAIL PROTECTED] wrote:
Hi.I know this has been discussed already, but still I'm opening it oncemore. I think there should be a way to preserve form state withoutvalidation and model updating.The use case is following.
I have a (complex) form with some fields, that can not be entereddirectly, i.e. they have to be selected on other page. So I need to movebetween pages, but I don't want to lose any information entered on theprevious page. If I use Button, the form gets processed, validated, etc
and the action won't execute unless all entered data is valid. If I turndefaultProcessing off, the action executes, but the data (not written tomodel yet) is lost.What I'm using now is little hacky, but it works. I have my own class
derived from Form, my own SubmitButton, ImmediateButton andFeedbackPanel. ImmediateButton acts like classic Button withdefaultFormProcessing turned off, but unlike it, ImmediateButton storesthe state in each component (in the string reserved for invalid data).
So there's my own Feedback panel (Although filter would be probablyenough) that detects that ImmediateButton was clicked and hidesvalidation messages (there's a lot of them, because ImmediateButtonmarks every component as invalid).
This approach works pretty well, but doesn't feel quite right. I thinkthere definitely should be a way to preserve form state (withoutvalidation and updating model) directly supported by wicket.Not to mention that (if I recall correctly) the string field in
FormComponent used for storing invalid data is transient.Btw. I've managed to persuade people from my company to use wicket forone of our projects. Since I do most of the current development, it'snot a big deal, because I've personally been using wicket for some time
now. But I can say they are really impressed with the productivity andsimplicity of certain actions (like moving between complex pages forthand back ;) - that are sometimes quite difficult and cumbersome in struts.
Not to mention excellent DataView and DatePicker components, markupinheritance and compoents in general.Kudos wicket team, you're doing excelent work!Sorry for really long mail,-Matej
---SF.Net email is sponsored by:Tame your development challenges with Apache's Geronimo App Server. Downloadit for free - -and be entered to win a 42 plasma tv or your very own
Sony(tm)PSP.Click here to play: http://sourceforge.net/geronimo.php___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Preserve form state

2005-11-14 Thread Johan Compagner
I will take this mail into account when i start workign on the Form Aware things 
(for example the selection change handler from a DropDown must also use the form)

johan
On 11/13/05, Matej Knopp [EMAIL PROTECTED] wrote:
Hi.I know this has been discussed already, but still I'm opening it oncemore. I think there should be a way to preserve form state withoutvalidation and model updating.The use case is following.
I have a (complex) form with some fields, that can not be entereddirectly, i.e. they have to be selected on other page. So I need to movebetween pages, but I don't want to lose any information entered on theprevious page. If I use Button, the form gets processed, validated, etc
and the action won't execute unless all entered data is valid. If I turndefaultProcessing off, the action executes, but the data (not written tomodel yet) is lost.What I'm using now is little hacky, but it works. I have my own class
derived from Form, my own SubmitButton, ImmediateButton andFeedbackPanel. ImmediateButton acts like classic Button withdefaultFormProcessing turned off, but unlike it, ImmediateButton storesthe state in each component (in the string reserved for invalid data).
So there's my own Feedback panel (Although filter would be probablyenough) that detects that ImmediateButton was clicked and hidesvalidation messages (there's a lot of them, because ImmediateButtonmarks every component as invalid).
This approach works pretty well, but doesn't feel quite right. I thinkthere definitely should be a way to preserve form state (withoutvalidation and updating model) directly supported by wicket.Not to mention that (if I recall correctly) the string field in
FormComponent used for storing invalid data is transient.Btw. I've managed to persuade people from my company to use wicket forone of our projects. Since I do most of the current development, it'snot a big deal, because I've personally been using wicket for some time
now. But I can say they are really impressed with the productivity andsimplicity of certain actions (like moving between complex pages forthand back ;) - that are sometimes quite difficult and cumbersome in struts.
Not to mention excellent DataView and DatePicker components, markupinheritance and compoents in general.Kudos wicket team, you're doing excelent work!Sorry for really long mail,-Matej
---SF.Net email is sponsored by:Tame your development challenges with Apache's Geronimo App Server. Downloadit for free - -and be entered to win a 42 plasma tv or your very own
Sony(tm)PSP.Click here to play: http://sourceforge.net/geronimo.php___Wicket-user mailing list
Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user