cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: Reg exp validation with Woody?
Date Mon, 01 Sep 2003 07:57:21 GMT
On Mon, 2003-09-01 at 02:00, Sonny Sukumar wrote:
> I'm looking for a solution to generate forms for every page of a checkout 
> process on an e-commerce site, and so I started looking at Woody.  I realize 
> it's a work in progress, but I figure if there's a sample of its use in 
> Cocoon 2.1 (which I'm using), it might just be able to do the job.
> 
> But I'm wondering if I can do field validation with it using regular 
> expressions.

Yep you can. The following is taken from the "form1" example of Woody:

  <wd:field id="ipaddress" required="true">
    <wd:label>Please enter your IP address</wd:label>
    <wd:datatype base="string">
      <wd:validation>
        <wd:regexp
pattern="^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$">
          <wd:failmessage>Invalid IP address.</wd:failmessage>
        </wd:regexp>
      </wd:validation>
    </wd:datatype>
  </wd:field>

>   I looked at this Wiki page and the one it links to on 
> validation syntax, and I didn't see anything about it:
> 
> http://wiki.cocoondev.org/Wiki.jsp?page=WoodyNotes

It's documented over here:

http://wiki.cocoondev.org/Wiki.jsp?page=WoodyReference

just search for "regexp".

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@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