Login Register

strugling to add onblur event to my text field

Hi ,

I am new to dojo tool kit.
my aim is to add onblur validation to my text field

how I can do this validation(it should be customized)

I tried this

dojo.addOnLoad(function(){
dojo.connect(dijit.byId('rchTxt'), "onblur",f1());
});

but f1 function is calling only once that is onload

how I can add this event

thanks in advance

take off the (). /* GeSHi

take off the ().

function someFunction(e){ 
   console.log('i ran.',e);
}
dojo.connect(dojo.byId("somenode"),"onblur",someFunction);

not working

Dante, that fix isn't working for me...

if I've got

dojo.connect(dijit.byId(myJSONObject[cnt].to_id), "onBlur", myTestFunction());

myTestFunction will fire once - onLoad - and never again.

if instead I have

dojo.connect(dijit.byId(myJSONObject[cnt].to_id), "onBlur", myTestFunction);

myTestFunction never fires.

Note that dijit.byId(myJSONObject[cnt].to_id) is a Dojo Editor (and I'm using Dojo 1.0.2).
I've tried varying onBlur and onblur, doesn't make a difference; also tried swapping out dijit.byId(id) for dojo.byId(id), document.getElementById(id), and the actual JS variable (the node is an editor created programmatically); nothing works beyond firing once when the function that creates the node (and then assigns the onblur) loads.

hi krishna

check ur code once with this

u have used dijit.byId('xxx');

replace that with following one

dojo.connect(dojo.byId("somenode"),"onblur",someFunction);

fixes something but still not working

Ok I see why I should use dojo.byId, however the behaviour I want is still not working. Please see http://www.dojotoolkit.org/forum/dijit-dijit-0-9/dijit-support/dojo-conn... as I don't want to derail this thread