on the first request to:

      www.mysite.com/clickPage?p=100

the page was loaded and then:

1. based on "p=100" I do consuming calculation to calculate
"calculatedValue"
2. now, I create the form, having "calculatedValue" as HiddenField.  (I dont
need the state "p" anymore for next steps)

When submitting the form,  page is called again (for second time), but now,
the value of "p" is not relevant anymore (it could also be many "p"'s like:
"p1", "p2", ... , "p100").
I want to handle the "post" request, and for that I need only
"calculatedValue" I dont care about "p" now.
But because the way Click works, I have to construct the FORM again so
"onSubmit" will be executed.  why should I ?  I am not going to render the
form again, I just want to process the "onSubmit" call and then decide to
redirect to somewhere else. (in other words, I dont need the data the I
needed before to construct the form)



On Fri, Apr 29, 2011 at 12:45 PM, Bob Schellink <[email protected]> wrote:

> This is fundamental to stateless, share nothing architectures. Each
> request needs all the information in order to satisfy the action. In
> your case you need p otherwise you cannot construct the form. There
> are geneally two options:
> - store P in the session
> - store P in a hiddenField and bind it's value explicitly if you need
> it before the onProcess event eg. during onInit:
>  ClickUtils.bind(pField);
>  pField.getValue();
>
> regards
>
> Bob
>
> On Fri, Apr 29, 2011 at 11:08 AM, Haim Schindler
> <[email protected]> wrote:
> > Hello,
> >
> > I am not sure what is the right way to use forms.
> > Sometimes its a problem when the form has to be constructed again after
> > submit and before the callback is called.
> >
> > Example:
> >
> > in url I type:
> >
> >      www.mysite.com/clickPage?p=100
> >
> > then in the click page I create a form.
> > based on the url parameter "p=100" in the form creation I do:
> >    ...
> >    Integer calculatedNumber = dbService.loadData(p);
> >    form.add(new HiddenField("calculatedNumber", calculatedNumber));
> >   ...
> >
> > I dont keep the "p" as a HIDDEN field in the form since I dont need it
> > anymore. all I care about now, is "calculatedNumber"
> >
> > the user clicked "SUBMIT"
> >
> > now, the calls should go to "onSubmit"
> > but before that, the form needs to be recreated, and it needs "p" to do
> so.
> > but "p" is not there anymore and then I get exception
> >
> > Am I missing something ?
> >
> > Thank you
> > Haim Schindler
> >
>

Reply via email to