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

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
 
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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top