Closed Bug 286184 Opened 20 years ago Closed 20 years ago

A JS function (insertrow())which adds a new row to the HTML page is not supported.

Categories

(Toolkit :: Form Manager, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 157578

People

(Reporter: ajaydhanuka, Assigned: bugs)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1 StumbleUpon/1.9992
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1 StumbleUpon/1.9992

This is my company website. We fill our timesheets. So, I cant give you the
USERID and PASSWORD. But am explaining the whole problem and give you the source
code.

 While filling timesheet there is Button which adds a row in which we enter the
data. We can add max of 96 rows per timesheet. 
I am sending you the source code which adds the new row in the html

function getphaseActivities()
{
	if (document.frmDaily.Phases.value == false || document.frmDaily.Phases.value
== 'NULL')
	{
		alert("Please select the Phase.");
		return false;
	}
	Activity1 = document.frmDaily.hPhaseActivity.value;//line no 117
	if (Activity1 == "")
	{
		alert("No Activities defined for this phase.");
		return true;
	}
	activities = Activity1.split("~");
	k = 0;
	x = eval("document."+"all(\"task\")");	
	i = parseInt(document.frmDaily.hCount.value);
	rc=0;
	rc = parseInt(document.frmDaily.activityrowcount.value);
	x.insertRow();
	i++;
	if (i > 96)
	{
		alert("Too many activities in a day? Please check the timesheet.");
		i--;
		return false;
	}
	x.rows[i].insertCell(); 
	x.rows[i].insertCell(); 
	x.rows[i].insertCell(); 
	x.rows[i].insertCell(); 
	x.rows[i].insertCell(); 
	x.rows[i].insertCell(); 
	t1 = "<select Name = Act"+i+" onchange='getjobcr("+i+")'><option></option>";
	j = 0;
	while(j < activities.length-1)
	{
		t1 = t1 + "<option value="+activities[j+1]+">"+activities[j+2]+"</option>";
		j+=3;
	}
	t1 = t1+"</select>";
	t2 = "<input Name=Hours"+i+" maxlength=2 size=10 onchange='settotal()'>";
	t3 = "<select Name=Min"+i+" size=1 onchange='settotal()'><option ></option>";
	t3 = t3 + "<option value=15>15</option><option value=30>30</option><option
value=45>45</option></select>";
	t4 = "<input Name=Job"+i+" maxlength=2 size=20 disabled>";
	t5 = "<input Name=Remark"+i+" size=30 maxlength=75>"
	wp=document.frmDaily.hDelivery.value;
	wps=wp.split("~");
	t6 = "<select Name = WorkProducts"+i+" ><option></option>";
	j = 0;
	p=document.frmDaily.Projects.value;
	s=document.frmDaily.subProjects.value;
	ph=document.frmDaily.Phases.value
	while(j < wps.length)
	{
		if ( p == wps[j] )
		  {
		    if ( s == wps[j+1])
		      {
		        if (ph == wps[j+2])
	             {  
	                t6 = t6 + "<option value="+wps[j+3]+">"+wps[j+4]+"</option>";
		            document.frmDaily.Workproductexist.value=1; 
		         }
		       } 
	      }	
		j+=5;
	}
	t6 = t6+"</select>";
	x.rows[i].cells[0].innerHTML = t1;
	x.rows[i].cells[1].innerHTML = t2;
	x.rows[i].cells[2].innerHTML = t3;
	x.rows[i].cells[3].innerHTML = t4;
	x.rows[i].cells[4].innerHTML = t5;
	x.rows[i].cells[5].innerHTML = t6;
	document.frmDaily.hCount.value = i;
	x.rows[i].cells[0].focus();
    rc = rc +1;
    document.frmDaily.activityrowcount.value=rc;
}

This insertrow() does not work in Firefox but works in IE

Reproducible: Always

Actual Results:  
A row should be added to the HTML

Expected Results:  
The page is locked and no rows are added
insertRow() requires an argument. You probably want to use insertRow(-1). 
And before you file a new bug for insertCell: Same here, it's insertCell(-1) if
you need to append the cell.

*** This bug has been marked as a duplicate of 157578 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.