PDA

Click to See Complete Forum and Search --> : similat to onchange


lenin
Nov 16th, 2000, 10:25 AM
Hi,
can anyone tell me if there is an event fired when the contents of a list box change. I don't think onchange is the required event: MS says:

This event is fired when the contents are committed and not while the value is changing. For example, on a text box, this event is not fired while the user is typing, but rather when the user commits the change by leaving the text box that has focus.

I have a list box which automatically matches a partial string as it is typed in a text box with its nearest full string in the list box. So as someone is typing the selected item in the text box changes. I need the method ( if one exists ) which is when when the contents change AND gfocus is not lost.

Any help greatly appreciated.

Lenin.

monte96
Nov 17th, 2000, 09:02 AM
That is true enough for a text box but onchange works as expected for a SELECT tag/list box.

lenin
Nov 17th, 2000, 10:26 AM
Monte, I tried the following:

<SELECT NAME="TownCombo" width=5 size="1" onChange="BuildList(this);">


<SCRIPT Language="JavaScript">
// Dynamic Town List
function BuildList(num)
{
alert("OH");
}

</Script>


The listbox does not have focus, but the contents continually changed based on my input to a textbox doing the match.

Let me know your thoughts.

Lenin.

monte96
Nov 17th, 2000, 01:30 PM
Wait. I just re-read your question.

If you mean when you add or remove option elements from the select element, then no there is no event for that. There is no event for that.

If you mean when the selected item changes, then onchange works.