I am working on a project where I am trying to map constraints onto Dijit controls in an XSLT to HTML.
One such constraint is the maximum length of a text field. However, I cannot find such a constraint within the Dojo constraint language.
Does such a constraint (excluding a RegEx one) exist that I have missed in my example below?
<label for="shortField">shortField </label>
<input id="shortField" data-dojo-type="dijit/form/ValidationTextBox"
data-dojo-props = "name: 'shortField',
width:400,
height:150,
value: '1234567890',
required: true,
constraints: { max:10, maxLength:10, length:10, size:10 }
" />
For consistency, I would prefer to make use of a constraint rather than setting the maxLength property of the _TextBoxMixin.
(Unfortunately, the setting of a regex in the constraints is also undesirable, as that may be overridden later, outside of my control.)
It appears that no such constraint exists. furthermore, since I found out that I additionally need to validate the minimum length, I have chosen the solution of subclassing the Dijit.Form.ValidationTextBox.
This is the implementation I have chosen for the isValid method ,which reads from the constraints, so I can keep my generating XSL code consistent. )