Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: date input

$
0
0
Re: date input
Web Connection
Re: date input
May. 13, 2013
12:14 pm
3S80Q8SB2Show this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Potter Orr
FoxPro format commands don't work in Web controls, so no that won't work. Using the format masks will format the date for display, but won't restrict the input in any way. The user can input whatever they want.

The way to handle this typically is to do your server side bindings and validation - if an invalid date is input the date binding will fail and give you a binding error. If you follow the typical examples in the Web Connection docs using business objects an invalid date will never make it through a save due to the validations.

Another option - and a good on IMHO - is to use the DatePicker control which will encourage users to pop up the calendar to pick dates. The calendar will ensure the date's in the right format.

Finally you can also write some JavaScript validation that can check for date formatting. This is easy if you're only dealing with US dates (ie. numbers and / input chars) and validating the final date to be valid, but it's a one time manual process. If you search you can probably find one.

+++ Rick ---


Years of Foxpro has dulled my mind. On a form a date variable automatically does all the work of formatting and requires the entry of a valid date.

Can I do this in Webconnection? I tried binding to a data variable and using either @yl or @d as a control source format but on the resulting web page I can type in anything.

Potter



Rick Strahl
West Wind Technologies


from Maui, Hawaii

Making waves on the Web


Viewing all articles
Browse latest Browse all 10393

Trending Articles