Expand my Community achievements bar.

SOLVED

Date/Calendar field validation question

Avatar

Former Community Member

I want to use the regular Date field, but unsure what's the best way to validate user's input.

The Display Format I am using is "DD MMM YYYY",

if the user uses the Calendar to pick the date, there's no issue.

However, the user can also type things into that field without using the built-in calendar,

what should I do when the user types "MM/DD/YYYY" (eg. "09/19/2011") ??

How to validate that?

If I put a validation pattern "DD MMM YYY" into the validation tab, it doesn't seem to work.

so, please help.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Add the same pattern in the Validation Pattern/Edit section and make sure that you include a Validation Pattern Message Text in the dialog informing the user which format you are expecting. If they enter the wrong format your message text will appear so make it informative.

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Add the same pattern in the Validation Pattern/Edit section and make sure that you include a Validation Pattern Message Text in the dialog informing the user which format you are expecting. If they enter the wrong format your message text will appear so make it informative.

Paul

Avatar

Level 2

In the Edit Field Put -     date{M/D/YY}|date{MM/DD/YYYY}|date{M-D-YY}|date{MM-DD-YYYY}

In your display field Put -  date{DD-MMM-YYYY}      or    date{DD-MMM-YY}           which ever you perfer.

Leave the Validation Blank.

With that in the Edit Field, it will correct if the user puts  04-01-1990  or 04/01/1990  and will convert to your format when entered

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----