Take the slash out of the calendar input

I'm working with a text input field and a RichWidgets\Input_Calendar. Currently the DateFormat is set to:  "%m/%d/%Y". This works fine for mm/dd/yyyy.  This is a great control because the users can either enter the date using the format, or they can select a date from the drop down calendar.

The only thing the users want me to change is to take the slashes out of the entry, so if a date is 04/25/2002, then they enter in 04252002. If I take the slashes out of the DateFormat (%m%d%Y) and type in 04252002, I get a "Date expected!" error.

Is there an easy way to handle this with the control's properties, or do I have to programmatically detect that there are no slashes and then programmatically put them in?

Thanks for your help,

Paul

Hi Paul

If the requirement is to make user input date without slashes then you need to programmatically detect the presence of slashes and put them in because the widget expects text in the same format as entered in its "DateFormat" field. 

Also make sure you perform proper validations on the date entered by user.

Please do mark it as solution if this answers your query.


Thanks 

I've found out that as I was trying to do that, if I enter in just 04252002, the input field returns to me a NullDate() value, so there is nothing to parse. I may have to tell the users that this can't be done while at the same time keep the selection calendar as well.

Thank you for your help,

Paul

Hi Paul Bainter,

Another option, to achieve your requirement is to set the Date Input Widget Variable data type to Text and on the submit button click action flow, validate the end-user provided date Input value (data validity check) before hitting the Entity Action node.


Hope this helps you!


Regards,

Benjith Sam

I like your reasoning, which is only slightly off from what I did. The input element for a date is normally a "Text" type with the RichWidgets\Input_Calendar (non-visible) to the side of it. When I inspect the variable attached to the input, it shows 01/01/1900 (nulldate). Even though it still shows 04252002 on the screen while I'm debugging, nothing in the attached variable shows what was entered. Since what was entered is an invalid date, it just shows me the 01/01/1900. 

Is there a way to get what was entered even though I entered an invalid date?

Kind Regards,

Paul

Hi Paul Bainter,

Sorry for the confusion (lack of description) in my previous post. The Text data type, which I mentioned is about the Local Variable which is mapped with Date Input widget as shown below.

- Below mentioned is the implementation, which I did for testing purpose.

Screen consists of - Date Input Widget (+ input_Calender) and Ok Button with set to Submit method type

On the click of the Ok Button, I debugged the code, in which I can see the date input widget value entered by the end-user, which is stored in the local variable (i.e Var_Date) as shown below.  

Hope this helps you!


Regards,

Benjith Sam