cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Custom Form Validator
Date Thu, 05 Jan 2006 11:32:59 GMT
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: 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


Mime
View raw message