[Dojo-interest] Failing XMLHttpTransport callback

Marc Poppleton marc.poppleton at teamlog.com
Wed Feb 14 04:30:41 MST 2007


Hi,
 
I'm discovering Dojo and I'm trying to use it doing a nice little form to
allow users to register to a website, prevented the username they type is
not already used.
Therefore I tried to make my own widget inheriting the ValidationTextBox
widget and with an extra function called checkLogin that performs an
XMLHTTPRequest on my server.
The snag is, I can't get it to work properly. I keep getting an error in the
handle of my bind:
DEBUG: XMLHttpTransport error callback failed: TypeError: this.isValid is
not a function

Could someone help me with this? I'm sure it's pretty damn stupid to solve,
but I'm lacking of javascript/Dojo knowledge to solve it myself.

Thanks,

Marc

The source code is:
-------------------------------- 
	dojo.provide("clockwork.widget.LoginValidationTextBox");
	dojo.require("dojo.widget.ValidationTextbox");
	 
	dojo.widget.defineWidget(
	    "clockwork.widget.LoginValidationTextBox",
	    dojo.widget.ValidationTextbox,
	 function() {
	  this.flags = {};
	 },
	 {
	  
	  validLogin: true,
	  validation_server_url : SRV_SCRIPT,
	  
	  onblur: function(evt) { 
	   this.filter();
	   this.update(); 
	   this.checkLogin();
	  },
	  
	  checkLogin: function(){
	    dojo.io.bind({
	         url: SRV_SCRIPT,
	         handle: function(type, data, evt){
	       		if(evt.status == 200){
	        			this.validLogin = true;
	       		}else{
	        			this.validLogin = false;
	       		}
	       		this.isValid();
	       },
	       content: {action : "check", login: this.getValue() }
	    });
	  },
	 
	    
	  isValid: function() {
	   return this.validLogin;
	  }
	 }
	);
--------------------------------



More information about the Dojo-interest mailing list