[Xsltforms-support] date validation
Brought to you by:
alain-couthures
From: Stephen C. <Ste...@ut...> - 2010-03-12 13:48:47
|
Looking at the js code I see that there is a regex pattern used to check formatting which is usually valid so the user input is not "wrong" and (visually flagged as such) then a parsing and a formatting step. I imagine the parsing is breaking the date string down and then building a Date value and this is where the behaviour might be wrong in that a new date is built and formatted but which may be different to what the user entered without him/her realising that this has occurred. They just see that it apparently valid and move on without checking the final result. I think that a different strategy where the individual parts of the date string are validated and then if all (years, months, days, hrs, minutes, seconds) are OK the whole date string can be checked as a valid javascript Date and then formatted. I'll look into this further but would appreciate if someone with more XSLTForms insight could take a look. -- Regards Stephen Cameron Data Programmer Integrated Marine Observing System (IMOS) eMarine Information Infrastructure Project University of Tasmania, Private Bag 21, Hobart, TAS 7001, Australia Tel: +61 3 6226 8507 Fax: +61 3 6226 2997 Email: ste...@ut... URL: http://www.imos.org.au/eMII.html |