Pawan
Pawan

Reputation: 32321

Dojo ValidationTextBox , invalidMessage is never shown

When and in what case , the invalidMessage is shown ?? Here in my case , the invalidMessage is never shown .

<input
        type="text"
        id="firstName"
        size="20"
        dojoType="dijit.form.ValidationTextBox"
        required="true"
        propercase="true"
        promptMessage="Enter first name."
        invalidMessage="First name is required."
        trim="true"


/>

Upvotes: 2

Views: 1555

Answers (1)

faken
faken

Reputation: 6852

Invalid message appears when the content of the text box is invalid according to a given regular expression (passed using the regExp parameter). In your case you do not pass a regExp parameter, so the content is always valid.

What you want is the "promptMessage" parameter, which appears when the text box is empty and on focus (null by default). Think of this like a tooltip that tells the user what to do, not an error message that tells the user what they've done wrong. Message disappears when user starts typing.

All of this is explained in the reference and in the API, both of which I have in my browser when programming with Dojo.

Upvotes: 2

Related Questions