Validating textarea elements using Dojo and Dijit.forms
I’ve been looking for a dojo textarea (dijit.form.SimpleTextarea) that supports the same validation as dijit.form.ValidationTextBox but all I could find is other people looking Â for the same thing.
So I’ve come up with this solution, which works well. Its basically a simple extension of SimpleTextarea, with the ValidationTextBox mixed in before it (its important to make sure ValidationTextBox is used before the SimpleTextarea otherwise this won’t work). I overrode the validate, onFocus and onBlur methods to force the popup of the invalidMessage.
To call this, use:
You can also add other validation attributes you’d normaly use in ValidationTextBox, like regExp to validate based on a regular expression.
The dojo component: