Closed Bug 309785 Opened 19 years ago Closed 19 years ago

window.confirm causes a javascript error in Firefox 1.5

Categories

(Firefox :: General, defect)

1.5.0.x Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mkromarek, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7
Build Identifier: Firefox/1.5

In firefox 1.5 the following code causes a javascript error


var ret = window.confirm("Are you sure that want to delete these records from
this table?");
	if (ret) 
	{
		document.itemCheck.iGo.value = 3;
	}


This code works fine in Firefox 1.0.7

Reproducible: Always

Steps to Reproduce:
1.have a button execute this code
2.click the button on the page
3.

Actual Results:  
The confirmation box did not come up, and instead threw a Javascript Error.

Expected Results:  
The software should have displayed a confirmation dialog box, asking me if I
wanted to deleted the selected records from the table.
A testcase would be nice.
Flags: testcase?
Version: unspecified → 1.5 Branch
window.confirm works fine for me in Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.8b5) Gecko/20050924 Firefox/1.4
Here's the parts of my code that relate to this problem.
NOTE: The following code is in a php file (it might have something to do with
the problem, but most likely not)


<script language="JavaScript" type="text/JavaScript">

//select the items list based on there model (ie, check all items with model xxxxx)
function modelClick(field)
{
	//alert(document.itemCheck['model[]'].length);
	for (i = 0; i < document.itemCheck['model[]'].length; i++)
	{
		
		if (document.itemCheck['model[]'][i].className == field)
		{
      			document.itemCheck['model[]'][i].checked = true;
    		}
    		else
    		{
    			document.itemCheck['model[]'][i].checked = false;
   		 }

	}
}

//function dealing with when the user clicks one of the 3 buttons
function go(num)
{
	document.itemCheck.insertGo.value =  num;
	
	$prob = 0;
	for (i = 0; i < document.itemCheck['model[]'].length; i++)
	{
		if(document.itemCheck['model[]'][i].checked == true)
		{
			$prob++;
			
		}
	}
	if($prob == 0 && num != 1 && num !=4) //uses reverse logic, if there arent any
checkboxs checked, do this
	{
		alert ("please check at least 1 check box");
	}
	else
	{
		//alert(num);
		document.itemCheck.action='MultiInsertItemEdit.php';
		(num==3?
document.itemCheck.action='MultiInsertModelEdit.php':document.itemCheck.action='MultiInsertItemEdit.php');
		

		document.itemCheck.submit();
	}

}

//function to set iGo, so that the page knows to insert the records
function insertRec()
{
	document.itemCheck.action='MultiInsertCheck.php';
	var ret = window.confirm("Are you sure that want to insert these records into
the database?\nThis process will insert the records from the table below, and
then clear the table.");
	if (ret) 
	{
		document.itemCheck.iGo.value = 2;
	}
	document.itemCheck.submit();
}

//feunction to set iGo, so that the page knows to delete the selected
function delRec()
{
	document.itemCheck.action='MultiInsertCheck.php';
	var ret = window.confirm("Are you sure that want to delete these records from
this table?");
	if (ret) 
	{
		document.itemCheck.iGo.value = 3;
	}
	document.itemCheck.submit();
}
	
	
</SCRIPT>

...........Big chunk of code that queries my DB, and spits out table containing
alot of item infor, and a chekk box in the first feild of every row........


<form name='itemCheck' action=<?echo "'".@$PATH_INFO."'";?> method='post'>
         <input type='hidden' name='iGo' value=0>
         <?
         echo "<input type='button' name='itemInfo' value='Edit Item
Information' onClick='go(2)'>
               <input type='button' name='modelInfo' value='Edit Model
Information' onClick='go(3)'>
               <input type='button' name='insert' value='Insert All Records'
onClick='insertRec()'>
               <input type='button' name='delete' value='Delete Selected
Records' onClick='delRec()'>"; ?>


--End of code--

So, when I click 'Insert All Records' or 'Delete Selected Records', instead of
asking me whether or not I want to do this action, it throws a JS error.  This
is odd, because, this page is currently in use, and doesn't have a problem under
Firefox 1.0.7, but Firefox 1.5 Beta 1, it throws an error.
Mike, will you please create a minimized testcase that displays this problem.
Neither of the examples you provided work. Also, if not the testcase, at least
paste the error the JS Console is spitting out.
Whatever was causing Javascript to error in Beta 1, has been fixed in Beta 2.  
I haven't changed anything in the code, so as far as I know, it's fixed.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Status: RESOLVED → UNCONFIRMED
Resolution: FIXED → ---
We don't know what fixed this worksforme.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → WORKSFORME
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: