You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Vasyl Stashuk <va...@acm.org> on 2004/01/13 15:24:36 UTC

Woody showForm and redirection

Hi!

How can i show Woody form in other http request by sending a client-side 
redirect (like cocoon.redirectTo) instead of using same request 
(cocoon.sendPageAndWait)?

vasyas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Woody showForm and redirection

Posted by Joerg Heinicke <jo...@gmx.de>.
On 15.01.2004 11:19, Marc Portier wrote:

>>> hm, pls explain why you would want to do that, since you will break 
>>> away from the most important pleasures of flowscript!
>>
>> Consider following example. Our form has repeat widget with some item 
>> list and additional fields for adding items (i.e. item name and submit 
>> button).
>> User wants to add new item. She enters name and presses the button. 
>> Form become redisplayed and new item appear in the list. If user press 
>> 'Refresh'
>> button on the browser for some reason, a new request for item addition 
>> will be sent. I wan't to avoid it. For this purpose, i want to handle 
>> business logic
>> of adding new user to the list in separate HTTP request, than 
>> rendering form view.
>>
> 
> Vasyl,
> 
> I'm not completely sure about this
> 
> I did try hitting refresh on the woody form2 sample after adding a row 
> to the repeater and the problem is not showing there, so maybe your 
> problem can be solved by more closely following the pattern offered there?

Same here. This is exactly what the continuations prevent!

Joerg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Woody showForm and redirection

Posted by Vasyl Stashuk <va...@acm.org>.
Marc Portier wrote:

>
>
> Vasyl Stashuk wrote:
>
>>
>> Consider following example. Our form has repeat widget with some item 
>> list and additional fields for adding items (i.e. item name and 
>> submit button).
>> User wants to add new item. She enters name and presses the button. 
>> Form become redisplayed and new item appear in the list. If user 
>> press 'Refresh'
>> button on the browser for some reason, a new request for item 
>> addition will be sent. I wan't to avoid it. For this purpose, i want 
>> to handle business logic
>> of adding new user to the list in separate HTTP request, than 
>> rendering form view.
>>
>
> Vasyl,
>
> I'm not completely sure about this
>
> I did try hitting refresh on the woody form2 sample after adding a row 
> to the repeater and the problem is not showing there, so maybe your 
> problem can be solved by more closely following the pattern offered 
> there?
>
> regards,
> -marc=
>
> <snip />
>
>>
>> Can I store continuation id in session?
>>
>>>
>
> I would strongly advise against doing that.
>
> -marc=

The difference between my code and form2 sample is the fact how model 
managed. If I get it right in form2 it is stored as continuation 
attribute. Hitting refresh won't change continuation and also won't 
change model.

I change the model by calling some services, i.e:
        model.allList = manager.getAll();

        form.load(model);
        form.showForm("view");
        form.save(model);

        if (form.submitId == "delete") {
            var row = form.getWidget().getSubmitWidget().getParent();
            var selected = row.getWidget("id").getValue();

            manager.delete(selected);
        } else if (form.submitId == "add") {
            manager.add(model.prop2, model.prop1);
        }

manager is the reference to business delegate that will call 
service-layer which is responsible for data management.

Can i work with flowscript in this way?

thank you for the help,
vasyas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Woody showForm and redirection

Posted by Marc Portier <mp...@outerthought.org>.

Vasyl Stashuk wrote:

> Marc Portier wrote:
> 
>>
>> hm, pls explain why you would want to do that, since you will break 
>> away from the most important pleasures of flowscript!
> 
> 
> Consider following example. Our form has repeat widget with some item 
> list and additional fields for adding items (i.e. item name and submit 
> button).
> User wants to add new item. She enters name and presses the button. Form 
> become redisplayed and new item appear in the list. If user press 'Refresh'
> button on the browser for some reason, a new request for item addition 
> will be sent. I wan't to avoid it. For this purpose, i want to handle 
> business logic
> of adding new user to the list in separate HTTP request, than rendering 
> form view.
> 

Vasyl,

I'm not completely sure about this

I did try hitting refresh on the woody form2 sample after adding a row 
to the repeater and the problem is not showing there, so maybe your 
problem can be solved by more closely following the pattern offered there?

regards,
-marc=

<snip />

> 
> Can I store continuation id in session?
> 
>>

I would strongly advise against doing that.

-marc=
-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Woody showForm and redirection

Posted by Vasyl Stashuk <va...@acm.org>.
Marc Portier wrote:

>
> hm, pls explain why you would want to do that, since you will break 
> away from the most important pleasures of flowscript!

Consider following example. Our form has repeat widget with some item 
list and additional fields for adding items (i.e. item name and submit 
button).
User wants to add new item. She enters name and presses the button. Form 
become redisplayed and new item appear in the list. If user press 'Refresh'
button on the browser for some reason, a new request for item addition 
will be sent. I wan't to avoid it. For this purpose, i want to handle 
business logic
of adding new user to the list in separate HTTP request, than rendering 
form view.

>
> in any case showForm additionally places the current form inside the 
> flow-context-bizdata under the key 'woody-form' and by default the 
> woody-template-transformer or the woody-generator will pick it up there
>
> since you want to have an explicit redirect over the browser you will 
> need to put the form somewhere in the session first, and then let the 
> woody-transformer or generator have it pick up over there...
>
> see http://wiki.cocoondev.org/Wiki.jsp?page=WoodyTemplateTransformer
> and search for the explanation of the @location attribute of the 
> wt:form-template
>
>
> but pls be warned: you will enter the hell of session management, and 
> loose the benefits of the continuations based approach to control your 
> use case. Do make sure that the reason to do that justifies the 
> additional effort that is waiting you... 


Can I store continuation id in session?

>
>
> regards,
> -marc=

thanks,
vasyas



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Woody showForm and redirection

Posted by Marc Portier <mp...@outerthought.org>.

Vasyl Stashuk wrote:

> Hi!
> 
> How can i show Woody form in other http request by sending a client-side 
> redirect (like cocoon.redirectTo) instead of using same request 
> (cocoon.sendPageAndWait)?
> 

hm, pls explain why you would want to do that, since you will break away 
from the most important pleasures of flowscript!

in any case showForm additionally places the current form inside the 
flow-context-bizdata under the key 'woody-form' and by default the 
woody-template-transformer or the woody-generator will pick it up there

since you want to have an explicit redirect over the browser you will 
need to put the form somewhere in the session first, and then let the 
woody-transformer or generator have it pick up over there...

see http://wiki.cocoondev.org/Wiki.jsp?page=WoodyTemplateTransformer
and search for the explanation of the @location attribute of the 
wt:form-template


but pls be warned: you will enter the hell of session management, and 
loose the benefits of the continuations based approach to control your 
use case. Do make sure that the reason to do that justifies the 
additional effort that is waiting you...

regards,
-marc=



> vasyas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org