Are regular expression integrated in DTML in some way?
It's unbelievable! I'm losing my MiNd! (And no I'm not selling furniture or used cars 8) I've spent the last 2 hours trying to find the answer to what I thought was a simple question. What is the simplest way to validate a form input date in the syntax of MM/DD/YYYY? I was thinking a simple regular expression would be ideal but I found no reference suggesting that regexp's are supported in DTML and you cannot import the regexp object in a Python script without creating a custom product/script and that seems too convoluted so that leads me to believe that there must be another way that I just haven't found yet. If you have a suggestion please let me know Regards, ttocco sindau2002@hotmail.com _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com
Tony:
It's unbelievable! I'm losing my MiNd!
hehehe... I know what your saying...
(And no I'm not selling furniture or used cars 8)
I've spent the last 2 hours trying to find the answer to what I thought was a simple question.
What is the simplest way to validate a form input date in the syntax of MM/DD/YYYY?
Does it matter if it is in MM/DD/YYYY? As long as it is a valid date, you can convert it to a DateTime object and display it however you want to. See code sample below...
I was thinking a simple regular expression would be ideal but I found no reference suggesting that regexp's are supported in DTML and you cannot import the regexp object in a Python script without creating a custom product/script and that seems too convoluted so that leads me to believe that there must be another way that I just haven't found yet.
If you have a suggestion please let me know
Try this code sample: --------------------------------------------------------- <dtml-let gooddateSTR="'02/04/2001'" baddateSTR="'02/2a/2001'"> <dtml-try> <dtml-call expr="REQUEST.set('gooddateDATETIME',_.DateTime(gooddateSTR))"> <dtml-except> This date is invalid: <dtml-var gooddateSTR> <dtml-else> This date is good: <dtml-var gooddateDATETIME fmt="%m/%d/%Y"> </dtml-try> <BR><BR> <dtml-try> <dtml-call expr="REQUEST.set('baddateDATETIME',_.DateTime(baddateSTR))"> <dtml-except> This date is invalid: <dtml-var baddateSTR> <dtml-else> This date is good: <dtml-var baddateDATETIME fmt="%m/%d/%Y"> </dtml-try> </dtml-let> ------------------------------------------------------- HTW, Andrew Williams
I was thinking a simple regular expression would be ideal but I found no reference suggesting that regexp's are supported in DTML and you cannot import the regexp object in a Python script without creating a custom product/script and that seems too convoluted so that leads me to believe that there must be another way that I just haven't found yet.
If you have Perl Methods installed and dont mind a few $'s, perl methods have regex's in them without any extra work. However thats probably more work than your other suggestions... -- Zopista
If you have Perl Methods installed and dont mind a few $'s, perl methods have regex's in them without any extra work. However thats probably more work than your other suggestions...
So do (python) external methods, and then you can stay in a nice language :-) *prod* *prod* Ooh look, a land mine... Chris
participants (4)
-
Andrew Williams -
Chris Withers -
Tony Tocco -
Zopista