Does dojo have some kind of input mask capabilities, more specifically for dates, or is there a pure javascript solution that does the trick? Something along the lines of this jquery plugin.
Yes, Dijit's DateTextBox will determine an appropriate format (mask?) for a Date based on the user's locale. You can override this using your own format (see datePattern) or choose between appropriate 'long' or 'short' formats (see formatLength)
There are other dijit.form widgets (variations of ValidationTextBox) which will constrain input for numbers and currencies. Also, you can use ValidationTextBox to specify your own regular expression, for things like telephone numbers or zip codes.
The widget your looking for is called dijit.form.DateTextBox
.
The functionality you are looking for is not called a mask in Dojo, it would be known as a constraint, and yes Dojo has support for a date range constraints. For example if you wanted to create an input field that had to be a date later than July of 2010 you could do something like this:
<input type="text" data-dojo-type="dijit.form.DateTextBox"
data-dojo-props='{
required: true,
promptMessage:"After July 2010",
constraints: {min:"2010-07-01"}
}'
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With