You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Martin Man <Ma...@seznam.cz> on 2001/04/12 19:35:59 UTC

[C2] FormValidator action

Hi all,
	This is my first coding contribution into c2, if you find it usefull
pls. include it.
	
	It for now does only check parameter type (string, long, double) and
whether it is null or not, if successfull the act method returns something
that you can explicitely configure via {result}, otherwise it returns null

example sitemap fragment follows
---------------------------------------------------------------------------
<map:match pattern="do-post">
    <map:act type="form validator">
   	<parameter name="descriptor"
   		value="context://descriptors/form-params.xml"/>
   	<parameter name="validate"
   		value="author,email,message"/>
   	<map:act type="add-employee">
   		<parameter name="form-descriptor"
   			value="context://db/guestbook-table-mapping.xml"/>
   		<map:redirect-to uri="view"/>
   	</map:act>
   </map:act>
   <map:redirect-to uri="post"/>
</map:match>

form-params.xml
-----------------------------------------------------------
<form-params>
	<param name="author" type="string" nullable="no"/>
	<param name="email" type="string" nullable="yes"/>
	<param name="message" type="string" nullable="no"/>
	<param name="xml-message" type="string" nullable="no"/>

	<param name="count" type="long" nullable="no"/>
	<param name="sallary" type="double" nullable="no"/>
</form-params>


in this simple guestbook example, when both actions (form validator, and
add-employee - which adds record to the database) are successfull, the
redirect to main 'view' page is sent, otherwise the user is just directed back
to page with form fields to fill, ...

hope you find it usefull... :-))

martin man


P.S. I'm working now the simiar way on SessionValidator and DBAuthenticator
-- 
-------------------------------------------------------------------------------
"Only dead fish swims with a stream"
gpg_key_available: http://globales.cz/~mman/martin.man.gpg
gpg_key_fingerprint: 2CC0 4AF6 92DA 5CBF 5F09  7BCB 6202 7024 6E06 0223

Re: [C2] FormValidator action

Posted by Davanum Srinivas <di...@yahoo.com>.
Martin,

Can you please Start from the current C2 CVS post a zip file containing.
- All the new files (with a directory structure)
  - XML files
  - XSL files
  - Java files
  - Any others.
- "cvs diff -u" of sitemap.xmap if any 
- "cvs diff -u" of samples.xml if any
- "cvs diff -u" of cocoon.xconf if any

This will expedite the process. 

Thanks,
dims

--- Martin Man <Ma...@seznam.cz> wrote:
> Hi all,
> 	This is my first coding contribution into c2, if you find it usefull
> pls. include it.
> 	
> 	It for now does only check parameter type (string, long, double) and
> whether it is null or not, if successfull the act method returns something
> that you can explicitely configure via {result}, otherwise it returns null
> 



=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

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