Thanks for your answer.
I also used
form.validator = myValidator;
But I don't want to do business stuff if the basic definition validation doesn't workI have :
function myValidator(form) {
if (!form.getWidget().isValid()) {
cocoon.request.setAttribute("formulaire", form.getWidget());
return false;
}-- some business stuff -- }
but when the form seems to be valid (and all required fields are present) from its definition validations, isValid() still returns false, and the business stuff is not executed.
My present validator code tests all fields values against the null value to see if definition validation passed successfully, but that's not very clean...
-- Olivier
On 06/01/2004 17:17, Markus Heussen wrote:
Hi!
I use
form.validator = myValidator;
placed before
form.showForm("form.display");
and in my validator function something like this
function myValidator(form) { var validationError = new Packages.org.apache.cocoon.woody.datatype.ValidationError("xxx"); if (!isDate(form.getWidget("vn_geburtsdatum").getValue(),"dd.MM.yyyy")) { form.getWidget("vn_geburtsdatum").setValidationError(validationError); return false; } return true; }
and this works fine for me. Only if all validations (in descriptor file and my flow validator function) give true the form is no more redisplayed.
Regards, Markus
-----Ursprungliche Nachricht----- Von: news Im Auftrag von Olivier Billard Gesendet: Dienstag, 6. Januar 2004 16:56 An: [EMAIL PROTECTED] Betreff: [Cocoon forms] interaction between definition validation and flow validator
Hi cocooners !
I asked a question yesterday, that is maybe not clear, so let me explain cleaner.
Cocoon forms offers 2 ways of validating a form : definition validation (with <wd:validation> in the form def file) and in the flow with the validator property of the flow form object.
And how can I combine the 2, if it's possible ? I would like to use the definition validation pour simple validations like required fields or min/max, and the flow validation in addition, for more complex things like unique values control in repeaters, or business actions...
My flow validator function begins with : <code> if (!form.getWidget().isValid()) { return false; } </code>
But even when the form seems to be valid, isValid() returns false, and I can never run "business validation" code after the test...
I'm using 2.1.2 version of cocoon.
Thanks,
-- Olivier BILLARD
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
