SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What event fires when you click a firefox 'remembered' dropdown item?

    Please bear with me... this is a complicated question and I think it's going to come out muddy...

    I am attempting to use the principles in [DHTML Utopia] - in other words, The DOM. I have two radio buttons, "There is Text" and "There is No Text", that reflect the state of a text box. The text box <input type="text"> either contains text or not, and as that state changes, the radio buttons will automatically show that.

    I have attached listeners to the textbox for all the standard events: mouseover, mouseup, mousedown, click, keyup, etc. etc... these all work well... each time one of those events occurs, javascript checks the length of the textbox value and if it's zero it sets the "No" radio button to 'checked'; otherwise it sets the "Yes" radio button to 'checked'.

    So here's the problem. Firefox remembers past values that i've entered in the text box and displays them as a dropdown list when I click in it. if i click one of those dropdown values, it's entered in the text box, but does not seem to trigger one of the standard events, and so the radio buttons don't respond. The radio button change function now fires only if i move the mouse back over the text box to fire a 'mousemove' or 'mouseover' event.

    So, finally, the core question: is there another event that can be added with the [addEventListener] function that will detect the clicking of the firefox dropdown box?

    Help & insight will be greatly appreciated.

    Alicia

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,191
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    event

    Hi medit8, welcome to the forums,
    Maybe onchange?

  3. #3
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Mittineague...

    Yes, I tried 'onchange' both in the textbox element itself, and then using [addEventListener('change', [action function], false)] to connect a 'change' event in the textbox with the action function. Unfortunately, 'onchange' requires moving the focus away from the element before it fires, and that doesn't happen with clicking the dropdown item.

    Any other thoughts?

    -- A.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    The best page I've found about this is http://www.quirksmode.org/bugreports...ot_firing.html

    Here is some test code that helps you to see what events are being fired. Nothing fires though when you click on an autocomplete entry.

    Code javascript:
    var el = document.getElementsByName('username')[0];
    el.onabort = function () { console.log('onabort event') };
    el.onblur = function () { console.log('onblur event') };
    el.onchange = function () { console.log('onchange event') };
    el.onclick = function () { console.log('onclick event') };
    el.ondblclick = function () { console.log('ondblclick event') };
    el.ondragdrop  = function () { console.log('ondragdrop  event') };
    el.onerror = function () { console.log('onerror event') };
    el.onfocus = function () { console.log('onfocus event') };
    el.onkeydown = function () { console.log('onkeydown event') };
    el.onkeypress = function () { console.log('onkeypress event') };
    el.onkeyup = function () { console.log('onkeyup event') };
    el.onload = function () { console.log('onload event') };
    el.onmousedown = function () { console.log('onmousedown event') };
    el.onmousemove = function () { console.log('onmousemove event') };
    el.onmouseout = function () { console.log('onmouseout event') };
    el.onmouseover = function () { console.log('onmouseover event') };
    el.onmouseup = function () { console.log('onmouseup event') };
    el.onmouseout = function () { console.log('onmouseout event') };
    el.onmove = function () { console.log('onmove event') };
    el.onreset = function () { console.log('onreset event') };
    el.onresize = function () { console.log('onresize event') };
    el.onselect = function () { console.log('onselect event') };
    el.onsubmit = function () { console.log('onsubmit event') };
    el.onunload = function () { console.log('onunload event') };
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,716
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    This bug report shows that the problem is known about. nothing appears to be happening on it though.

    https://bugzilla.mozilla.org/show_bug.cgi?id=359387
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #6
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much Paul... seems to be the same as I found out through trial and frustration.

    -A.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •