cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Spaeth <Jonathan.Spa...@networktelephone.net>
Subject RE: Advanced form validation using jxforms
Date Thu, 24 Jul 2003 18:15:11 GMT
Well, I have solved my own problem...it seems that jxpath has been upgraded
since I last browsed the docs and java functions can be directly called from
xpath.
 
Therefore, with the jdk 1.4, I am able to do the following within my schema:
 
  <rule context="timestamp">
   <assert test="string-length(.) &gt; 0">Enter a the date and
time.</assert>
   <!-- date format: mm-dd-yyyy hh:mi am|pm -->
   <assert
test="java.util.regex.Pattern.matches('^\s*\d{2}-\d{2}-\d{4}\s+\d{1,2}:\d{2}
\s+[ap]m\s*$', .)">Enter the date and time in the proper format.</assert>
  </rule>

Just thought I'ld share the solution to the problem I posted regarding
validation using regular expressions!
 
Jon

-----Original Message-----
From: Jonathan Spaeth [mailto:Jonathan.Spaeth@networktelephone.net] 
Sent: Thursday, July 24, 2003 10:12 AM
To: 'dev@cocoon.apache.org'
Subject: Advanced form validation using jxforms



I have been working on a set of cocoon apps for the past three or four
months now. The basic idea is simple data management; replacing a large
number of spreadsheets with sql-database-driven apps using cocoon and
jxforms (originally xmlform, but I migrated when jxforms became available).

The problem or issue I have recently come across is the need to do more
advanced form validation than is easily doable with the standard set of
xpath functions.  Specifically, if some type of regular expressions
functionality were available to the schematron validator system, the
validation system would be much more powerful.

Currently, (as far as I know; please correct me if I'm wrong), the only way
to register a jxpath extension function is by manipulating java code.  If
the validator classes were modified to ... Say ... Register a java class to
use as a jxpath extension function by associating it with a namespace within
the schematron xml document, I believe we could obtain some regular
expression matching or validation within the jxforms validator.

Any questions or suggestions or comments? 

Jon 


Mime
View raw message