Hi,

I have fixed my issue by modifying the widget value
from the flowscript (in a catch) when the database complains.

...
 var form = new Form(...);
 form.createBinding(...);
 form.load(binding);
 while (invalid) {
   form.showForm(...);
   form.save(binding);
   try {
     database.createObject(binding);// throws exception
     invalid=false;
   catch (ex if (ex.javaException instanceof InvalidNameException)) {
           // InvalidNameException is a java exception
var error = new ValidationError('name.already.exist', false); // also tried with true
     var nameWidget = form.lookupWidget('name');
nameWidget.setValue(''); // the widget is correclty reseted on the output
     nameWidget.setValidationError(error);
   }
 }
 cocoon.showPage(...);
...

But i don't manage to have my error message displayed.
Any help is welcome.

Regards,

Raphaël

Raphaël Piéroni a écrit :
Hi guys,

I have a cform which works well.
The flowscript (ECMA) that handles the cform delegates
to a spring bean to create an object in database.
But when that objet already exist it throws an exception.

I had managed to catch the exception in the flow script.
But i would like to know if (and how) to perform a validation
of the nonexistence of the object i try to create before calling
my spring beans. for this purpose i can add a check method on
the spring beans.
But how do i give the beans from the flow script
to the cform for it to use in validation? How to i define the
validation to perform in the cform?

If there is some doco on the subjet, pleas'e redirect me to the doco.


Best regards,


Raphaël


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to