cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <>
Subject [CForms] URL Validator
Date Wed, 08 Jun 2005 16:33:35 GMT
I'm in need of a simple URL validator for CForms. It should test 
whether a string value represents a well-formed URL and if it doesn't, 
prepend "http://" and try again.

I think this would nicely cover the use case where you need to specify 
a website address in a form but don't want to force users to specify 
the protocol.

Has anybody come up with something similar before?

Also, I would like the field value to be a well-formed URL in any case, 
so it should always contain a protocol part. Is it allowed for a 
validator to change the value of its widget? Would it be better instead 
to define a new "url" datatype and corresponding convertor? It looks 
cleaner, but it also seems overkill to define a validator, a datatype 
and a convertor (plus factory classes) just to cover this simple use 



Ugo Cei
Tech Blog:
Open Source Zone:
Wine & Food Blog:
View raw message