You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Uchenna Igwebuike <uc...@sbcglobal.net> on 2004/04/06 17:43:14 UTC
Cform - Help with redisplaying form after submission
I have a form that after validation by cocoon, the transaction could
still fail for some other reasons. I want to redisplay the form with
some messages after it has been submitted. I cannot seem to use the
<action> widget for this as it does not perform validation.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Cform - Help with redisplaying form after submission
Posted by Uchenna Igwebuike <uc...@sbcglobal.net>.
Thanks, this worked after I downloaded another cocoon src from the dev
tree.
-----Original Message-----
From: Mark Lundquist [mailto:ml@wrinkledog.com]
Sent: Tuesday, April 06, 2004 2:28 PM
To: users@cocoon.apache.org
Subject: Re: Cform - Help with redisplaying form after submission
On Apr 6, 2004, at 1:05 PM, Uchenna Igwebuike wrote:
> Mark,
>
> Attached is the sitemap, flow script and the form model.
>
OK well, maybe I am misunderstanding your problem, but... what I've
been trying to say is, why aren't you doing this?:
while (true) {
...
myForm.showForm("material-type-display-pipeline", data);
...
}
~ mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cform - Help with redisplaying form after submission
Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Apr 6, 2004, at 1:05 PM, Uchenna Igwebuike wrote:
> Mark,
>
> Attached is the sitemap, flow script and the form model.
>
OK — well, maybe I am misunderstanding your problem, but... what I've
been trying to say is, why aren't you doing this?:
while (true) {
...
myForm.showForm("material-type-display-pipeline", data);
...
}
~ mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Cform - Help with redisplaying form after submission
Posted by Uchenna Igwebuike <uc...@sbcglobal.net>.
Mark,
Attached is the sitemap, flow script and the form model.
Thanks
-----Original Message-----
From: Mark Lundquist [mailto:ml@wrinkledog.com]
Sent: Tuesday, April 06, 2004 11:36 AM
To: users@cocoon.apache.org
Subject: Re: Cform - Help with redisplaying form after submission
On Apr 6, 2004, at 11:05 AM, Uchenna Igwebuike wrote:
> Below is a snapshot of the flow
I might be able to help if you include the whole flowscript function
instead of just an excerpt. For instance, I can't see the loop in what
you sent.
~ mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cform - Help with redisplaying form after submission
Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Apr 6, 2004, at 11:05 AM, Uchenna Igwebuike wrote:
> Below is a snapshot of the flow
I might be able to help if you include the whole flowscript function
instead of just an excerpt. For instance, I can't see the loop in what
you sent.
~ mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Cform - Help with redisplaying form after submission
Posted by Uchenna Igwebuike <uc...@sbcglobal.net>.
Mark,
I am actually using an application exception send the message(String
key, Object[]) to the client and then a utility within the flow to
retrieve an i18n message from a resource bundle using the user's locale.
The message is then bound to an output widget and then I want to
redisplay the same form with the messages and original form content.
I have a "close" submit button which the user can use to end the loop
I there a way that I can update the form model with the message and then
redirect the user to the previous continuation id just like how
<actions> behave?
Thanks.
Below is a snapshot of the flow
form.showForm("material-type-display-pipeline", data); //show form
//if submit is a close exit the loop
if (form.submitId == "close") {
dispatch = null;
cocoon.sendPage("");
}else {
var msg = form.getWidget("message");
form.save(bean);
try {
//Perform backend processing
}catch(ex) {
var msg = form.getWidget("message");
if(ex instanceof Packages.BaseAppException) {
var i18nVal = Packages.ExceptionHandler.
getWebExceptionMessage("bundleName","users locale",ex);
msg.value = i18nVal;
} else {
throw ex;
}
}
form.showForm("material-type-display-pipeline", data); //redisplay form
-----Original Message-----
From: Mark Lundquist [mailto:ml@wrinkledog.com]
Sent: Tuesday, April 06, 2004 10:25 AM
To: users@cocoon.apache.org
Subject: Re: Cform - Help with redisplaying form after submission
On Apr 6, 2004, at 9:52 AM, Uchenna Igwebuike wrote:
> Thanks mark
>
> When I redisplay form using
>
> form.showForm("material-type-display-pipeline", data);
>
> it will redisplay the form but the continuation id changes and If I
> post
> the form this point it doesn't execute the correct flow and comes back
> with a blank page.
Well, sure :-)... it does what you expect resuming a continuation to
do, right? It sounds to me like you just want to wrap a big loop
around the showForm() and all the rest. There's nothing wrong with
that! Nothing says a flowscript ever has to return (although if you
want to get fancy and implement a server-side 'dismiss' you can do
that, too).
>
> I am trying to have all the messages displayed with an <output> widget
> in the form and not have to create a new JXTemplate pipeline as the
> user
> could continue to edit the form even after saving the changes.
Not sure exactly what you mean by "create a new JXTemplate pipeline"...
if you mean a new invocation of the pipeline, that of course is
happening anyway no matter what. If you mean "a separate pipeline in
the sitemap", there's no need for that... just have one pipeline that
starts w/ the JXTG, and use the jx:template anyway even when you don't
have an extra message to display.
It looks like 'bean' is your "DTO" (and 'sproxy' the interface to the
'real' model)? In which case you would be shoving the failure message
into 'bean' so it can get bound to your output widget? Nothing wrong
w/ that... I probably would have used JXTG, but it's all a matter of
taste I guess...
~ mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cform - Help with redisplaying form after submission
Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Apr 6, 2004, at 9:52 AM, Uchenna Igwebuike wrote:
> Thanks mark
>
> When I redisplay form using
>
> form.showForm("material-type-display-pipeline", data);
>
> it will redisplay the form but the continuation id changes and If I
> post
> the form this point it doesn't execute the correct flow and comes back
> with a blank page.
Well, sure :-)... it does what you expect resuming a continuation to
do, right? It sounds to me like you just want to wrap a big loop
around the showForm() and all the rest. There's nothing wrong with
that! Nothing says a flowscript ever has to return (although if you
want to get fancy and implement a server-side 'dismiss' you can do
that, too).
>
> I am trying to have all the messages displayed with an <output> widget
> in the form and not have to create a new JXTemplate pipeline as the
> user
> could continue to edit the form even after saving the changes.
Not sure exactly what you mean by "create a new JXTemplate pipeline"...
if you mean a new invocation of the pipeline, that of course is
happening anyway no matter what. If you mean "a separate pipeline in
the sitemap", there's no need for that... just have one pipeline that
starts w/ the JXTG, and use the jx:template anyway even when you don't
have an extra message to display.
It looks like 'bean' is your "DTO" (and 'sproxy' the interface to the
'real' model)? In which case you would be shoving the failure message
into 'bean' so it can get bound to your output widget? Nothing wrong
w/ that... I probably would have used JXTG, but it's all a matter of
taste I guess...
~ mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Cform - Help with redisplaying form after submission
Posted by Uchenna Igwebuike <uc...@sbcglobal.net>.
Thanks mark
When I redisplay form using
form.showForm("material-type-display-pipeline", data);
it will redisplay the form but the continuation id changes and If I post
the form this point it doesn't execute the correct flow and comes back
with a blank page.
I am trying to have all the messages displayed with an <output> widget
in the form and not have to create a new JXTemplate pipeline as the user
could continue to edit the form even after saving the changes.
Below is a piece of the flow script that I am using.
var msg = form.getWidget("message");
form.save(bean);
try {
if(dispatch != null) {
if(dispatch.equals("create")) {
sproxy.createMaterialType(locale,bean);
dispatch = "update"; //reset to ensure back button
will not create new objects
}else if(dispatch.equals("update")) {
sproxy.updateMaterialType(locale,bean);
}
//Load form with data from DB
bean = sproxy.readMaterialType(locale,bean.name);
form.load(bean);
var args = [bean.name];
var i18nVal = Packages.MessageHandler.getMessage
(inventoryMessages,myForm.locale,"materialType.message.save",args);
msg.value = i18nVal;
}
}catch(ex) {
if(ex instanceof Packages.exceptions.BaseAppException)
{
var i18nVal = Packages.ExceptionHandler.
getWebExceptionMessage(inventoryMessages,myForm.locale,ex);
msg.value = i18nVal;
} else {
throw ex;
}
}
//Redisplay the form with the transaction messages
form.showForm("material-type-display-pipeline", data);
-----Original Message-----
From: Mark Lundquist [mailto:ml@wrinkledog.com]
Sent: Tuesday, April 06, 2004 9:31 AM
To: users@cocoon.apache.org
Subject: Re: Cform - Help with redisplaying form after submission
On Apr 6, 2004, at 8:43 AM, Uchenna Igwebuike wrote:
> I have a form that after validation by cocoon, the transaction could
> still fail for some other reasons. I want to redisplay the form with
> some messages after it has been submitted. I cannot seem to use the
> <action> widget for this as it does not perform validation.
You can explicitly redisplay the form from your flow, and use
JXTemplate to implement the failure message(s).
~mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cform - Help with redisplaying form after submission
Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Apr 6, 2004, at 8:43 AM, Uchenna Igwebuike wrote:
> I have a form that after validation by cocoon, the transaction could
> still fail for some other reasons. I want to redisplay the form with
> some messages after it has been submitted. I cannot seem to use the
> <action> widget for this as it does not perform validation.
You can explicitly redisplay the form from your flow, and use
JXTemplate to implement the failure message(s).
~mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org