CalcBuilder Forum

How to validate date ?

Usuario moon_1330 2013-11-29 06:13:11

Hi mate

Should I set field type as "Text" or " Date" ?

Should I type "date" in CSS field? It does not work when I set field type as "Date"

Should I set Frontend Date format in Preferences tab as "%d-%m-%Y" ? but the result include the "%"

I try everything above ,but even I type some random number ,say "456" , the email still can be sent without validation.

Thank you

Moonsoft support 2013-11-29 09:43:23

Hi,
you can use both text or date and then add the validation. The type date will allow to display the calendar as a helper to fill the field. You can set as css on both cases 'date' or 'dateISO', this will validate the user typed text. Also if you use the type date and thus the calendar, you should also set the date format at preferences to ensure the day selected at the calendar is formatted the same way (so it will pass your validation). As date can be locale dependent, for dateISO you should set at format date

yy/m/d

(any characters other that the standard for years,months.. will be printed at the result, like / , - , or %)

Hope this helps, regards

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
CalcBuilder

Create dynamic calculators

Buy now!