ASP.NET 2 - TextBox control on IE 5 Mobile - onblur does not fire

  • Thread starter Thread starter Duncan
  • Start date Start date
D

Duncan

Hi all,

I'm tearing my hair out on this!

I have a simple ASP.NET 2 page with a TextBox control, in the
PreRender I set ClientSide events:-

Response.Attributes.Add("onchange",
"javascript:alert('Changed');");
Response.Attributes.Add("onfocus",
"javascript:alert('Has Focus');");
Response.Attributes.Add("onblur",
"javascript:alert('Lost Focus');");

In the destop browser everything is fine, all events fire as expected.

When I open the same page from a PDA running Mobile IE 5, only the
onfocus and onchange events fire, onblur never does.

The Internet Explorer Mobile Reference page tells me that these, and
only these events can be caught in the mobile browser but I can't make
it work.

Can anyone save my sanity!

Cheers,

Duncan
 
Hi all,

I'm tearing my hair out on this!

I have a simple ASP.NET 2 page with a TextBox control, in the
PreRender I set ClientSide events:-

                Response.Attributes.Add("onchange",
"javascript:alert('Changed');");
                Response.Attributes.Add("onfocus",
"javascript:alert('Has Focus');");
                Response.Attributes.Add("onblur",
"javascript:alert('Lost Focus');");

In the destop browser everything is fine, all events fire as expected.

When I open the same page from a PDA running Mobile IE 5, only the
onfocus and onchange events fire, onblur never does.

The Internet Explorer Mobile Reference page tells me that these, and
only these events can be caught in the mobile browser but I can't make
it work.

Can anyone save my sanity!

Cheers,

Duncan

Some additional information that I've found from testing.

The onblur DOES work for Radio Buttons - haven't tested other controls
yet.

The onblur IS getting added as an attribute to the <input
type='text'... /> control - I can see it using the getAttribute
method, and it has the correct script command attached to it.

There also appears to be a problem with the getAttribute command in
general.

According to the Internet Explorer Mobile Reference the method should
return a null if the attribute is not found, instead an exception is
thrown, but without any details attached to the error object.

Here's the JS function that I'm using to check :-

function findAttributes(control) {
try {
alert ('in findAttributes');
//alert ('onfocus = ' +
control.getAttribute('onfocus'));
alert ('onblur = ' + control.getAttribute('onblur'));
alert ('about to get wrongattribute');
var attrib = control.getAttribute('wrongattribute');
alert ('got wrongattribute');
//if (control.getAttribute('wrongattribute') == null)
{
// alert ('Attribute not found');
//}
//else
//{
// alert ('wrongattribute = ' +
control.getAttribute('wrongattribute'));
//}

controlCurrent = control;
if (control.type == 'text')
{
alert ('this is a text control');
}
else
{
alert ('this is NOT a text control');
}
}
catch(e) {
catch(e) {
alert ('Error - ' + e.description);
alert ('Error - ' + e.message);
alert ('Error - ' + e.name);
alert ('Error - ' + e.number);
alert ('Error - ' + e.toString());
}
}

Just thought you might like to know.

Duncan
 
Back
Top