Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post

    onsubmit in firefox

    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?

    Code:
    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');">

  • #2
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    What's supposed to happen
    Code:
    if(rowCount ==5)

  • #3
    New Coder
    Join Date
    Mar 2012
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post
    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

  • #4
    New Coder
    Join Date
    Mar 2012
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post
    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);
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •