Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 2207 invoked from network); 8 Dec 2003 12:12:42 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 8 Dec 2003 12:12:42 -0000 Received: (qmail 93853 invoked by uid 500); 8 Dec 2003 12:12:37 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 93824 invoked by uid 500); 8 Dec 2003 12:12:36 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 93808 invoked from network); 8 Dec 2003 12:12:36 -0000 Received: from unknown (HELO exchange.sun.com) (192.18.33.10) by daedalus.apache.org with SMTP; 8 Dec 2003 12:12:36 -0000 Received: (qmail 13135 invoked by uid 50); 8 Dec 2003 12:12:49 -0000 Date: 8 Dec 2003 12:12:49 -0000 Message-ID: <20031208121249.13134.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: dev@cocoon.apache.org Cc: Subject: DO NOT REPLY [Bug 25303] - Enhanced validation for selection lists X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25303 Enhanced validation for selection lists ------- Additional Comments From agallardo@agsoftware.dnsalias.com 2003-12-08 12:12 ------- Currently we can make use of: form.validator = myFormValidator; form.showForm("yourForm-display"); The first line sets a customised validator for the form. The myFormValidator() allow us to validate right after woody makes all his validations. They are not exclusive. The function allow write complex validations for a form. Here is an example in Javascript: function myFormValidator(form) { var emp_id = parseInt(cocoon.request.emp_id); factory = cocoon.getComponent(Packages.o.a.c.ojb.jdo.components.JdoPMF.ROLE); bean = empresaHandler.retrieve(emp_id, factory); if (!(bean instanceof Packages.test.Employee)) { form.getWidget("errorMessages").addMessage("Select an Employee on list"); return false; } else { return true; } } The above funtion must return false if the validation failed (there are some errors). Otherwise return true (data are OK). Maybe this is not perfect, but we are using in the definition a as follow: The operation failed. Please This element allow us to show the problems to the user. If we don't use the addMessage() funtion, then the widget is not showed at all.