BulldogMike
asked on
Date Input Validation and Translation in Lotus Notes
Hi
How would you approach this problem? I need to translate a date entry in a form field into the standard MM\\DD\YY or MM\DD\YYYY format so the user dosen't need to enter the slashes. At the same time, I want to validate the entry so that alpha characters would be rejected. Will the @Date function work here or do I need to write a script.
Please advise
Thank you - Mike
How would you approach this problem? I need to translate a date entry in a form field into the standard MM\\DD\YY or MM\DD\YYYY format so the user dosen't need to enter the slashes. At the same time, I want to validate the entry so that alpha characters would be rejected. Will the @Date function work here or do I need to write a script.
Please advise
Thank you - Mike
BEWARE of "translating" dates!!!!
ALWAYS use a DATE field and apply the "formatting" to the field (normally you would use the users setting, which could also be as in my case: 2010-10-27)
that way you will never have issues "working" (exporting/calculating) with the date values.
If you start meddling around with "text" formatting of dates you will (almost guaranteed) encounter problems later as soon as you need to "work" with those values
ALWAYS use a DATE field and apply the "formatting" to the field (normally you would use the users setting, which could also be as in my case: 2010-10-27)
that way you will never have issues "working" (exporting/calculating) with the date values.
If you start meddling around with "text" formatting of dates you will (almost guaranteed) encounter problems later as soon as you need to "work" with those values
I guess I don't fully understand either. Are the users entering the date into a field on a notes form? If so, why not change the Style of the field from Notes Style to Calendar/Time Control. That way the user just selects the date from a calendar and you're done. Formatting is taken care of.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks to everyone who responded to my question. I learned something form all of you but I am not sure I aske the question properly to get the desired respones and will reward all of you with points if allowed
Thank You again
BulldogMike
Thank You again
BulldogMike
ASKER
Thanks again to eryone for your help
WIthout knowing exactly what you want I would look at using the input validation portion of the field to put in something like
@If(@IsError(@TextToTime( Fieldname )); @Failure("Please enter a date in this field" ); @Success)
Prior to that you could try the replace function to replace spaces with slashes if they are going to enter spaces instead of slashes so you would end up with
@ReplaceSubstring( Fieldname; " " : "." : "-"; "/" )
so the whole thing would look like
@If(@IsError(@TextToTime( @ReplaceSubstring( Fieldname; " " : "." : "-"; "/" ) )); @Failure("Please enter a date in this field" ); @Success)