You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Brent L Johnson <br...@bjohnson.net> on 2004/02/10 18:14:16 UTC

Form Validator Problem

I **know** I'm missing something here.. but
I'm following through the form-validation
docs and it seems easy.. but everytime I
run this pipeline I get sent to the error
page and the xsp-formval:on-xxx calls dont
seem to be give me the expected output even
when there is an error.

Can someone please have a look at this
and point out what I'm missing?  I've been
staring at this and the docs for a while
and it's driving me crazy.. because it looks
to me like it should work.

-----------------
Sitemap:

<map:match pattern="mail/send.html">
    <map:act type="auth-protect">
        <map:parameter name="handler" value="authhandler"/>

        <map:act type="form-validator">
            <map:parameter name="descriptor"
value="send_descriptor.xml"/>
            <map:parameter name="validate-set" value="send-email"/>
            <map:generate type="serverpages" src="mail/send_ok.xsp"/>
            <map:transform src="skins/{global:skin}/main.xsl"/>
            <map:serialize type="html"/>
        </map:act>
        <map:generate type="serverpages" src="mail/send_error.xsp"/>
        <map:transform src="skins/{global:skin}/main.xsl"/>
        <map:serialize type="html"/>
    </map:act>
</map:match>

Descriptor:

<root>
  <parameter name="email_to" type="string"
matches-regex="^[\d\w][\d\w\-_\.]*@([\d\w\-_]+\.)\w\w\w?$"
nullable="no"/>
  <constraint-set name="send-email">
    <validate name="email_to"/>
  </constraint-set>
</root>

send_error.xsp (snippet):

<xsp-formval:on-nomatch name="email_to">
    OUCH!  No email_to!?
</xsp-formval:on-nomatch>
DONE!
-----------------

Well.. no matter what I put in my email_to text field,
I get sent to the error page.  I tried changing the validation
to just nullable="no" with no regexp and changing
the xsp-formval:on-nomatch to on-notpresent and on-null.

I'm sure I'm missing something.. but by comparing this
to the doc.. I just dont see whats missing.

Thanks,

- Brent


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


RE: Form Validator Problem

Posted by Brent L Johnson <br...@bjohnson.net>.
OK - I took a break and went and had some lunch.
When I got back I decided to check the logs.. and
in the sitemap.log I found the problem.

I knew it was something small I was missing..
I gave the action the incorrect path for
the send_descriptor.xml file!

- Brent

> I **know** I'm missing something here.. but
> I'm following through the form-validation
> docs and it seems easy.. but everytime I
> run this pipeline I get sent to the error
> page and the xsp-formval:on-xxx calls dont
> seem to be give me the expected output even
> when there is an error.
> 
> Can someone please have a look at this
> and point out what I'm missing?  I've been
> staring at this and the docs for a while
> and it's driving me crazy.. because it looks
> to me like it should work.
> 
> -----------------
> Sitemap:
> 
> <map:match pattern="mail/send.html">
>     <map:act type="auth-protect">
>         <map:parameter name="handler" value="authhandler"/>
> 
>         <map:act type="form-validator">
>             <map:parameter name="descriptor" 
> value="send_descriptor.xml"/>
>             <map:parameter name="validate-set" value="send-email"/>
>             <map:generate type="serverpages" src="mail/send_ok.xsp"/>
>             <map:transform src="skins/{global:skin}/main.xsl"/>
>             <map:serialize type="html"/>
>         </map:act>
>         <map:generate type="serverpages" src="mail/send_error.xsp"/>
>         <map:transform src="skins/{global:skin}/main.xsl"/>
>         <map:serialize type="html"/>
>     </map:act>
> </map:match>
> 
> Descriptor:
> 
> <root>
>   <parameter name="email_to" type="string" 
> matches-regex="^[\d\w][\d\w\-_\.]*@([\d\w\-_]+\.)\w\w\w?$"
> nullable="no"/>
>   <constraint-set name="send-email">
>     <validate name="email_to"/>
>   </constraint-set>
> </root>
> 
> send_error.xsp (snippet):
> 
> <xsp-formval:on-nomatch name="email_to">
>     OUCH!  No email_to!?
> </xsp-formval:on-nomatch>
> DONE!
> -----------------
> 
> Well.. no matter what I put in my email_to text field,
> I get sent to the error page.  I tried changing the 
> validation to just nullable="no" with no regexp and changing 
> the xsp-formval:on-nomatch to on-notpresent and on-null.
> 
> I'm sure I'm missing something.. but by comparing this
> to the doc.. I just dont see whats missing.
> 
> Thanks,
> 
> - Brent
> 
> 
> ---------------------------------------------------------------------
> 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