tags:

views:

35

answers:

1

Hi everyone, I want to add an on blur event to a dojo timetextbox but the event never been runned so the declaration of the timetextbox is like this:

<label>End</label><input id="endp" name="endp"  onBlur="calculateTimeSpent2(startp,endp,output);"  />

the javascript function is like this:

function calculateTimeSpent2(startp,endp,outputp)

{

var tmp0=document.getElementById('startp').value.split(':');

var tmp1=document.getElementById('endp').value.split(':');

if (tmp0[0]!='' && tmp1[0]!='') { var val1= findtime(tmp0[0],tmp0[1],tmp1[0],tmp1[1]);

var tmp=val1.split(':');
if (tmp[0].indexOf('-')==-1)
    document.getElementById('outputp').value=val1;
else 
{
    alert ("Start Time must be lower than End Time ");
    document.getElementById('endp').focus();
}

} }

I don't understand why dojo didn't execute the event correctly while loosing the focus. I tried to put the type=text but it does'nt work. Thanks for help.

A: 

startp, endp and output are probably undefined at the time the method handler is invoked. It doesn't look like your function actually uses the arguments it names. Perhaps you don't need to pass in any values at all?

peller