cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: Cforms storing data in Database and error handling
Date Fri, 30 Dec 2005 15:19:00 GMT
Marcel Rouwenhorst wrote:
> Hi,
> I have a question on what is the best way to store data with Cforms.
> I use Oracle stored procedures to store data in the database but the 
> stored procedures can return an error with an out parameter (string) 
> and the error should be presented to the user in the Cform.
> For example: I have a registration form with a nickname. The nickname 
> has to be at least 3 characters long. This validation can be done by 
> CForm. But also the nickname has to be unique. This check is done by 
> the stored procedure at the moment we try to add the user with the 
> stored procedure. Further i would like to minimize the amount of calls 
> to the database, for performance reasons. So a separate query to check 
> for uniqueness of the nickname is not what I like.
> So the question is where to put the stored procedure so I can put 
> manual (by code) error messages to the Cform.
> I see 3 possible places to put this code (maybe there are more):
> - flowscript: I got the stored procedure call working from this point, 
> but exiting the show form every time to do the stored procedure 
> doesn’t seems right to me..
> - bindings framework: seems to me the best solution, but can I call 
> the stored procedure from here and send (by code) the generated error 
> messages back to the Cform?
> - using the event handler?
> Any examples or tips on the adding of error messages to the Cform 
> would be great.
> If anybody can help me with this question that would be great.

The best solution is to add a custom validator to the nickname field. If 
you don't want to write a Java class, that custom validator can be 
written as a JavaScript snippet that has access to all flowscript 
top-level functions and variables.

 From a usability point of view, it would be better to trigger this 
validation in a value-change listener, but that would mean a separate 
query to check uniqueness, which you say you don't want.


Sylvain Wallez                        Anyware Technologies           
Apache Software Foundation Member     Research & Technology Director

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message