You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mark H <ma...@markhorgan.com> on 2003/10/09 16:06:17 UTC
Woody - action widget disables validation
Can someone tell me why an action widget disables validation in Woody? I'm
trying out a simple form that doesn't involve validation, but it can never
get onto the success page because of the following code:
org.apache.cocoon.woody.formmodel.Form:
public boolean process(FormContext formContext) {
...
readFromRequest(formContext);
...
if (formContext.doValidation())
return validate(formContext);
return false;
}
formContext.validation will be set to false when it calls the action
widget's readFromRequest method and so will return false which in turn
returns a null sitemap map to the sitemap and never shows the success page
contained within the action tags.
Mark
my widgets:
<?xml version="1.0" encoding="ISO-8859-1"?>
<wd:form xmlns:wd="http://apache.org/cocoon/woody/definition/1.0">
<wd:field id="username" required="true">
<wd:label>Username</wd:label>
<wd:datatype base="string"/>
</wd:field>
<wd:field id="password" required="true">
<wd:label>Password</wd:label>
<wd:datatype base="string" />
</wd:field>
<wd:action id="login" action-command="login">
<wd:label>Login</wd:label>
</wd:action>
</wd:form>
my form view:
<?xml version="1.0"?>
<page xmlns:wt="http://apache.org/cocoon/woody/template/1.0"
xmlns:wi="http://apache.org/cocoon/woody/instance/1.0" title="A Form">
<wt:form-template action="form" method="POST">
<wt:widget id="username"/>
<wt:widget id="password"/>
<wt:widget id="login"/>
</wt:form-template>
</page>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Woody - action widget disables validation
Posted by Mark H <ma...@markhorgan.com>.
> Why should it perform validation? A user will often press an action
> button when the form is not completed yet and will thus obviously be
> full of validation errors.
It's a misunderstanding on my part - I'm used to XMLForms where submit
buttons are kind of actions (the request parameter is prefixed with
cocoon-action).
> -----Original Message-----
> From: users-return-56445-mailinglists=markhorgan.com@cocoon.apache.org
> [mailto:users-return-56445-mailinglists=markhorgan.com@cocoon.apache.org
> ]On Behalf Of Bruno Dumon
> Sent: 09 October 2003 21:45
> To: users@cocoon.apache.org
> Subject: Re: Woody - action widget disables validation
>
>
> On Thu, 2003-10-09 at 16:06, Mark H wrote:
> > Can someone tell me why an action widget disables validation in Woody?
>
> Why should it perform validation? A user will often press an action
> button when the form is not completed yet and will thus obviously be
> full of validation errors.
>
> There is now however a "submit" widget, which is identical to the action
> widget, but also performs validation. You may try that one.
>
> <snip/>
> > <wd:action id="login" action-command="login">
> > <wd:label>Login</wd:label>
> > </wd:action>
> > </wd:form>
> <snip/>
>
> Why are you using an action widget here (instead of a normal form
> submit)?
>
> --
> Bruno Dumon http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> bruno@outerthought.org bruno@apache.org
>
>
> ---------------------------------------------------------------------
> 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: Woody - action widget disables validation
Posted by Bruno Dumon <br...@outerthought.org>.
On Fri, 2003-10-10 at 12:18, Mark H wrote:
> > There is now however a "submit" widget, which is identical to the action
> > widget, but also performs validation. You may try that one.
>
> Is that widget new to 2.1.2? I can't seem to find it in 2.1.1.
yep, it's very new. Don't know if it is in 2.1.2, but it certainly is in
current CVS. There has also been a refactoring of the event-handling,
with addition of value-changed events.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org bruno@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Woody - action widget disables validation
Posted by Mark H <ma...@markhorgan.com>.
> There is now however a "submit" widget, which is identical to the action
> widget, but also performs validation. You may try that one.
Is that widget new to 2.1.2? I can't seem to find it in 2.1.1.
> -----Original Message-----
> From: users-return-56445-mailinglists=markhorgan.com@cocoon.apache.org
> [mailto:users-return-56445-mailinglists=markhorgan.com@cocoon.apache.org
> ]On Behalf Of Bruno Dumon
> Sent: 09 October 2003 21:45
> To: users@cocoon.apache.org
> Subject: Re: Woody - action widget disables validation
>
>
> On Thu, 2003-10-09 at 16:06, Mark H wrote:
> > Can someone tell me why an action widget disables validation in Woody?
>
> Why should it perform validation? A user will often press an action
> button when the form is not completed yet and will thus obviously be
> full of validation errors.
>
> There is now however a "submit" widget, which is identical to the action
> widget, but also performs validation. You may try that one.
>
> <snip/>
> > <wd:action id="login" action-command="login">
> > <wd:label>Login</wd:label>
> > </wd:action>
> > </wd:form>
> <snip/>
>
> Why are you using an action widget here (instead of a normal form
> submit)?
>
> --
> Bruno Dumon http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> bruno@outerthought.org bruno@apache.org
>
>
> ---------------------------------------------------------------------
> 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: Woody - action widget disables validation
Posted by Bruno Dumon <br...@outerthought.org>.
On Thu, 2003-10-09 at 16:06, Mark H wrote:
> Can someone tell me why an action widget disables validation in Woody?
Why should it perform validation? A user will often press an action
button when the form is not completed yet and will thus obviously be
full of validation errors.
There is now however a "submit" widget, which is identical to the action
widget, but also performs validation. You may try that one.
<snip/>
> <wd:action id="login" action-command="login">
> <wd:label>Login</wd:label>
> </wd:action>
> </wd:form>
<snip/>
Why are you using an action widget here (instead of a normal form
submit)?
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org bruno@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org