...

View Full Version : onsubmit in firefox



SamHuff
03-19-2012, 02:37 PM
i have the following code being called from onsubmit event of form and it is not working in firefox. when debugging it will return at the line of code "row = parcelTable.rows(4);" Any ideas?




parcelTable = document.getElementById("parcelTable");

if(x=="parcel" && (ptaxd.value == "" || ppid.value == "" || puid.value == "" )){
rowCount = parcelTable.rows.length;
row = parcelTable.rows(4);
if(rowCount ==5){
}else{
row = parcelTable.insertRow(4);
}
cellCount = row.cells.length;
errorCell = row.insertCell(cellCount);
if(cellCount==0) errorCell = row.insertCell(cellCount+1);
errorCell.innerHTML = "Must enter all three fields.";
errorCell.setAttribute("id","error");
errorCell.style.color = "red";
isItGarbage = false;
parcelError = true;
}

<form id="parcelForm" name="by_parcel" action="BasicShell" method="get" onsubmit="return validate('parcel');">

webdev1958
03-19-2012, 02:43 PM
What's supposed to happen

if(rowCount ==5)

SamHuff
03-19-2012, 05:44 PM
nothing is supposed to happen. i should have changed the logic on it to make more sense. but it's just checking to see if the 5th row in the table needs to be inserted or not. i have several blocks of code like this so if there is more than one error i want it to appear in a different sell on the same row and not insert an additional row which it does fine but i'm pretty sure it has something to do with this

row = parcelTable.rows(4);

firefox will return an empty value to the onsubmit event when this row executes. works fine in IE

SamHuff
03-19-2012, 05:51 PM
nevermind i figured it out.

row = parcelTable.rows(4);

the 5th(4) row didn't exist yet. i'm surprised this worked at all in IE too.

thanks for looking though. you were right to question that if statement

should be

if(rowCount ==5){
row = parcelTable.rows(4);
}else{
row = parcelTable.insertRow(4);
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum