cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Cforms storing data in Database and error handling
Date Fri, 30 Dec 2005 11:55:31 GMT
I would go for binding framework with ojb, or something like open access. In your flowscript
, you can do something like:

var message;
var store;
while (!store) {
    
   cocoon.sendPageAndWait(url, {message:message});
  
   form.load(bean);
   form.showForm("poll-form-display");
   store = form.save(bean);
   if(!store){
   message = "Duplicate";
   } 
}

Now, in your ojb object model, do the check if the nickname exists. If it does, return false,
if it does not, store it and continue.

That should be it

AS

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.
 
Happy New Year to everyone!!
 
Marcel

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


Mime
View raw message