Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 49795 invoked from network); 18 Feb 2010 21:46:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Feb 2010 21:46:50 -0000 Received: (qmail 21317 invoked by uid 500); 18 Feb 2010 21:46:49 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 21249 invoked by uid 500); 18 Feb 2010 21:46:49 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 21241 invoked by uid 99); 18 Feb 2010 21:46:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Feb 2010 21:46:49 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gary.larsen@envisn.com designates 216.57.116.7 as permitted sender) Received: from [216.57.116.7] (HELO mx2.pshift.com) (216.57.116.7) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Feb 2010 21:46:41 +0000 Received: from JAVAGUY1 (unverified [68.191.255.250]) by mx2.pshift.com (Vircom SMTPRS 4.7.840.5) with ESMTP id ; Thu, 18 Feb 2010 16:46:19 -0500 X-Modus-BlackList: 68.191.255.250=OK;gary.larsen@envisn.com=OK X-Modus-RBL: 68.191.255.250=OK X-Modus-Trusted: 68.191.255.250=NO X-Modus-Audit: FALSE;0;0;0 From: "Gary Larsen" To: , References: Subject: RE: Validator ?s Date: Thu, 18 Feb 2010 16:53:34 -0500 Message-ID: <37F73EA978464AB994774B4ED7AF4B7C@envisnofc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acqw0jQpRaLByk8bR2eUDswH28XmWwAEbjXw In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Hi Jeff, I think the error condition needs to be set in the validator: ((ValidationErrorAware)widget).setValidationError(new ValidationError("date_selection_error", true)); Hope that's what you're looking for. There are a few constructors - this one uses i18n. gary > -----Original Message----- > From: Schmitz, Jeffrey A [mailto:Jeffrey.A.Schmitz@boeing.com] > Sent: Thursday, February 18, 2010 2:40 PM > To: users@cocoon.apache.org > Subject: Validator ?s > > Hello, > In the validator documentation is states the following: > > As an alternative for fd:java, you can also add validators at run time to > a form instance, using the addValidator method on a form or widget. Since > you then instantiate the validator yourself, you can pass it anything you > want, and it can be stateful. > > However, it doesn't really say where in the cocoon ecosystem this > injection of a validator needs to occur. Can anyone provide specifics on > this? E.g. is this done somewhere in the flowscript? > > Also, I've tried following the instructions for added a java validtor > using fd:java, but it's not getting triggered. Below is my code, any > ideas why it doesn't seem to be working? > > > Name: > > > > > > > User does not exist. > > > > package com.boeing.ssp.cforms; > > import org.apache.avalon.framework.logger.AbstractLogEnabled; > import org.apache.cocoon.forms.formmodel.Widget; > import org.apache.cocoon.forms.validation.WidgetValidator; > > import com.boeing.mifssp.CFormUtils; > > public class LoginValidator extends AbstractLogEnabled implements > WidgetValidator { > > /** > * @see > org.apache.cocoon.forms.validation.WidgetValidator#validate(org.apache.coc > oon.forms.formmodel.Widget) > */ > public boolean validate(Widget widget) { > String loginStrs[] = new String[1]; > getLogger().info("Validating user " + (String) widget.getValue()); > > loginStrs[0] = (String) widget.getValue(); > boolean goodLogin = CFormUtils.submitIfQuery("loginCheck", > "ivhm", "ModelManagement", null, null, loginStrs); > return goodLogin; > } > } > > Thanks, > Jeff > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org