Closed Bug 255377 Opened 20 years ago Closed 18 years ago

JS Error on AutoComplete popup

Categories

(Toolkit :: Form Manager, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 236791

People

(Reporter: phil, Assigned: dveditz)

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461; .NET CLR 1.1.4322)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040707 Firefox/0.9.2

Error: [Exception... "'Permission denied to get property 
XULElement.selectedIndex' when calling method: 
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e 
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: http://URL/ :: 
scrubPin :: line 14"  data: no]
Source File: http://URL/
Line: 14

Source Code:
<script type="text/javascript">

function scrubPin(testField, maxLength, nextCell) {

	var inputValue = testField.value;
	var outputValue;
	
	if (inputValue.length >= maxLength) {	
		outputValue = stripNonNumeric(inputValue);
		testField.value = outputValue;
		
		if (outputValue.length >= maxLength) {
		
			document.entryForm[nextCell].focus();
			
		}
	}

}

function stripNonNumeric(inputValue) {
	return inputValue.replace(/[^\d]/g,'');
}
		
</script>

<form name="entryForm">
<input type="text" name="pin1" onKeyUp="scrubPin(this, 4, 'pin2');">
<input type="text" name="pin2" onKeyUp="scrubPin(this, 4, 'pin3');">
<input type="text" name="pin3" onKeyUp="scrubPin(this, 4, 'firstName');"><br>
<input type="text" name="firstName">
</form>


Reproducible: Always
Steps to Reproduce:
1. Fresh install of Mozilla(?) e.g. never used AutoComplete before
2. Run source code above
3. Enter 4 digits into first box

Actual Results:  
JS Error in console

Expected Results:  
Not generated an error
This has nothing to do with the js debugger.  Maybe "Form Handling"?
Assignee: rginda → dveditz
Component: JavaScript Debugger → Form Manager
QA Contact: caillon
I have a shorter example of similiar bug. And enter any symbol into text field,
then press Enter (don't click on submit button). then check Javascript Console.

<html>
<body>
<form action="http://www.example.com" method="get" name="frmq">
	<input type="text" name="query" value="">
	<input onClick="if (frmq.query.value.length<10 && frmq.query.value.length>0)
{alert('Too short');return false;}" type="Submit">
</form>
</body>
</html>
I get his error when I try it. LInux 2004120106

Error: [Exception... "'Permission denied to get property XULElement.accessKey'
when calling method: [nsIDOMXULLabelElement::accessKey]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
file:///home/jess/file.html :: onclick :: line 2"  data: no]
Source File: file:///home/jess/file.html
Line: 2
Error still occures in actual build
(Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.7) Gecko/20050414
Firefox/1.0.3)

To avoid it, you can add the attribute autocomplete="off" to the input field
Hey, this is a duplicate of bug 236791. Can someone with the necessary
privileges mark this as a dupe?

*** This bug has been marked as a duplicate of 236791 ***
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
Product: Core → Toolkit
QA Contact: form.manager
You need to log in before you can comment on or make changes to this bug.