Carl Franks wrote:
2009/3/17 Matija Grabnar <mat...@serverflow.com>:
Given the constraint:
- type: Text
name: start
label: From
attributes:
class: date
constraints:
- type: DateTime
parser:
regex: '^\s*(\d{4})-(\d{2})-(\d{2})\s*\d{0,2}:\d{2}:\d{2}\s*$'
params: [ year, month, day ]
I get the error:
Caught exception in MyApp::Controller::Root->edit "The 'regex' parameter
("^\s*(\d{4})-(\d{2})-(\d{2})\s*\d{0,2}:\d{2}:\d{2}\s*$") to
DateTime::Format::Builder::Parser::create_single_parser was a 'scalar',
which is not one of the allowed types: scalarref
Any ideas on what I may be doing wrong? I tried googling it, but got nothing
that seemed like a solution.
Hmm, maybe it only accepts an actual regex object, and not a string.
Try this in your config:
regex: !!perl/regexp (^\s*(\d{4})-(\d{2})-(\d{2})\s*\d{0,2}:\d{2}:\d{2}\s*$)
The string you gave me complained about "unmatched ) in regex". However,
replacing the first ( and the last ) with a / gave me a working regex.
Thank you!
Can I suggest that someone should change the documentation for
Constraint::DateTime?
_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu