Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Date Field - allows any string?

Avatar

Former Community Member

I am using a standard date/time field on LC form, data format = date.  However, it lets users enter any string, and am needing it to only be date.  I will set a validation pattern, but before setting, want to be sure first, is this normal, that a date field allows any type of string to be manually entered (they used Sept. 30, 2014 as their answer, and when I imported the response into Access, of course it didn't pass the Access side of bringing into a date field).

One thing I've noticed is you have to place your cursor in the date fields before the drop-down date picker will show.  Is there a future plan to have the drop-down arrow show even if no cursor in field?  Just an 'enhancement' request, as someone may not notice that and keep typing.  I had wrongly assumed a date field would only accept date formatted data, so as a workaround, am setting validation patterns, but was hoping for a better understanding of this field for the future.  Thank you!

Message was edited by: sparrowce

Additional info - when I test validation, have set everything to the date pattern needed, and in testing, it will give the error message if I enter a string, but then the field still accepts the string.  Am needing to know how to properly validate the date field, thank you!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,  This is standard behaviour and is the same for a decimal field once you add an edit format like num{$zzzz9.99} you can type whatever you want.  So you will need to validate the value yourself.  If the value entered matches the edit pattern then it will be converted to the internal format of YYYY-MM-DD, if not then the invalid value will be copied across as it.  This means that as long as your display pattern is not YYYY-MM-DD an invalid date will be one that has a formattedValue == rawValue.  You may need multiple edit formats as well to allow different formats to be entered.

These posts my help;

http://cookbooks.adobe.com/post_An_alternative_Date_Picker_for_LiveCycle_Designer-18455.html

http://cookbooks.adobe.com/post_Date_handling_in_Livecycle_Designer_ES_forms-19697.html

Regards

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,  This is standard behaviour and is the same for a decimal field once you add an edit format like num{$zzzz9.99} you can type whatever you want.  So you will need to validate the value yourself.  If the value entered matches the edit pattern then it will be converted to the internal format of YYYY-MM-DD, if not then the invalid value will be copied across as it.  This means that as long as your display pattern is not YYYY-MM-DD an invalid date will be one that has a formattedValue == rawValue.  You may need multiple edit formats as well to allow different formats to be entered.

These posts my help;

http://cookbooks.adobe.com/post_An_alternative_Date_Picker_for_LiveCycle_Designer-18455.html

http://cookbooks.adobe.com/post_Date_handling_in_Livecycle_Designer_ES_forms-19697.html

Regards

Bruce

Avatar

Former Community Member

Thank you very much, yes, the links are excellent!  For this form, the format itself is not so important how it displays or otherwise except how the value lands in the field, as I'm importing it into Access, and Access will take care of it from there, but if it's an unrecognizable string, that becomes a problem.  I really like the sample that was in the first link, that has a pop-up calendar as soon as you place your cursor in it, it's much easier for the person completing the form to see right away and select a date, and much faster to navigate through the years.  The way the standard LC date picker works, it is very possible for the person completing the form to not see the drop-down arrow to the right of the field, and the pop-up calendar in 1st link is extremely nice, thank you again!