Problem with onChange using autocomplete
-
- Posts: 6
- Joined: September 12th, 2007, 4:20 am
Problem with onChange using autocomplete
Hello,
I'm currently using firefox 2.0.0.6 and when I use the autocomplete feature I don't have the onChange event fired. While I was using the versions before firefox 2 the thing that I mentioned before worked as I expected.
Does anybody have an explanation for this change?
Here I have a html sample that generates this issue.
<html>
<head>
<title>Mozilla Firefox Problem</title>
<script language="javascript">
function fOnChange()
{
alert('OnChange Fired');
}
</script>
</head>
<body>
<form name="frm">
<table>
<tr>
<td><input type="text" name="textBox" onChange="javascript:fOnChange()"></td>
</tr>
<tr>
<td><input type="submit" value="Submit"></td>
</tr>
</form>
</body>
</html>
Steps to generate the "problem"
1) Type a text in the text box and then press Submit.
2) Type another word and do the same as before.
3) Double click the text box (you'll see a list with the words typed before), choose one of items, press the Submit button and then you'll realize that the message 'OnChange Fired' will not be displayed.
Thanks in advance.
Charles
I'm currently using firefox 2.0.0.6 and when I use the autocomplete feature I don't have the onChange event fired. While I was using the versions before firefox 2 the thing that I mentioned before worked as I expected.
Does anybody have an explanation for this change?
Here I have a html sample that generates this issue.
<html>
<head>
<title>Mozilla Firefox Problem</title>
<script language="javascript">
function fOnChange()
{
alert('OnChange Fired');
}
</script>
</head>
<body>
<form name="frm">
<table>
<tr>
<td><input type="text" name="textBox" onChange="javascript:fOnChange()"></td>
</tr>
<tr>
<td><input type="submit" value="Submit"></td>
</tr>
</form>
</body>
</html>
Steps to generate the "problem"
1) Type a text in the text box and then press Submit.
2) Type another word and do the same as before.
3) Double click the text box (you'll see a list with the words typed before), choose one of items, press the Submit button and then you'll realize that the message 'OnChange Fired' will not be displayed.
Thanks in advance.
Charles
-
- Posts: 653
- Joined: June 8th, 2005, 6:10 am
The onChange event should apparently fire when focus leaves a form element and it's contents have changed between it receiving focus and losing it.
As this is not happening in this case and that would seem to be a pretty strong indicator that this is a bug.
The onchange event occurs when a control loses the input focus and its value has been modified since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and TEXTAREA.
As this is not happening in this case and that would seem to be a pretty strong indicator that this is a bug.
-
- Posts: 653
- Joined: June 8th, 2005, 6:10 am
Looks like this bug: https://bugzilla.mozilla.org/show_bug.cgi?id=87943 - which is over 6 years(!) old...
Meantime, you can do this:
Meantime, you can do this:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Mozilla Firefox Problem</title>
<script type="text/javascript">
function fOnChange()
{
alert('OnChange Fired');
}
var val_textBox;
function fOnFocus()
{
val_textBox = document.getElementById('textBox').value;
}
function fOnBlur()
{
if (val_textBox != document.getElementById('textBox').value) {
fOnChange();
}
}
</script>
</head>
<body>
<form name="frm">
<table>
<tr>
<td><input type="text" id="textBox" name="textBox" onFocus="fOnFocus()" onBlur="fOnBlur()"></td>
</tr>
<tr>
<td><input type="submit" value="Submit"></td>
</tr>
</form>
</body>
</html>
-
- Posts: 6
- Joined: September 12th, 2007, 4:20 am
That's me again...
I remembered one important thing....as I mentioned before (Im currently using firefox 2.0.0.6 and when I use the autocomplete feature I don't have the onChange event fired. While I was using the versions before firefox 2 the thing that I mentioned before worked as I expected.) this problem started to happen in firefox 2.0.0.0...
Waiting for more other replies....
I remembered one important thing....as I mentioned before (Im currently using firefox 2.0.0.6 and when I use the autocomplete feature I don't have the onChange event fired. While I was using the versions before firefox 2 the thing that I mentioned before worked as I expected.) this problem started to happen in firefox 2.0.0.0...
Waiting for more other replies....