Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11632 closed enhancement (worksforme)

ValidationTextBox: setting a custom error-message

Reported by: Chris2 Owned by:
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.5
Keywords: ValidationTextBox, custom message Cc:
Blocked By: Blocking:


As stated on following site:

it is possible to override validator to do some custom validations maybe on server-side (async). But there is not stated how to apply a custom error message to the ValidationTextBox? when that server-function returns. The method "displayMessage" looks like i am looking for but it does not set the error state. An new function which accomplishes that would be nice. Something like:

function setError(msg){
	this.state = "Error";
	dijit.setWaiState(this.focusNode, "invalid", "true");

But i got no idea how to prevent that "validate" removes the error-state on refocus. Overriding validate seems not to be the best idea.

Background: Currently i am not overriding "validator" because i just want to validate after lost focus and keep the regexp-validation. So i am using onBlur to send a request to the server.

Change History (2)

comment:1 Changed 11 years ago by bill

Resolution: worksforme
Status: newclosed

Well you would need to override isValid() to return false (after you got your validation response from the server). I think that will do it for you. Plus either overriding getErrorMessage() or with the newest code I guess you could do a set("message", ...).

comment:2 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.