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

Discussion in 'ASP .Net' started by Duncan, May 14, 2008.

  1. Duncan

    Duncan Guest

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

    "javascript:alert('Has Focus');");
    "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!


    Duncan, May 14, 2008
    1. Advertisements

  2. Duncan

    Duncan Guest

    Some additional information that I've found from testing.

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

    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

    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 = ' +
    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');
    // alert ('wrongattribute = ' +

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

    Just thought you might like to know.

    Duncan, May 15, 2008
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.