You can put fd:validation in you form. For example, start you fd:form with <fd:form id="data" xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> <fd:validation> <fd:javascript> return messageValidator(widget); </fd:javascript> </fd:validation>
and in flow function messageValidator(form){ var date = form.lookupWidget("removeDate").getValue(); var now = new Date(); if (date.before(now)){ var validationError = new ValidationError("yi!"); form.lookupWidget("removeDate").setValidationError(validationError); } return (!date.before(now)); } AS > > > Dustin N. Jenkins wrote: > > Does anyone have experience writing Custom Form Validators? > We need a > > way of accessing our Spring Service Layer from one of our Cocoon > > Custom Validators, but the Validator doesn't seem to have access to > > the HTTP Request or Session or anything else that's > exterior to it. > > Is there an easy way of acquiring the Spring Application Context or > > the HTTP Request that someone knows of? > > If you use flowscript, you can write a custom validator in > Javascript. > It will have access to the "cocoon" object and all global > variables of > the flowscript. > > Sylvain > > -- > Sylvain Wallez Anyware Technologies > http://bluxte.net http://www.anyware-tech.com > Apache Software Foundation Member Research & Technology Director > > > --------------------------------------------------------------------- > 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]