Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6567261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:18:57+00:00 2026-05-25T14:18:57+00:00

I have a table inside a form, which is populated with various input boxes.

  • 0

I have a table inside a form, which is populated with various input boxes. I have written various JavaScript functions that will allow the user to add or remove a row from the table, and will also dynamically rename the element names that come after where the user has entered the row (if that makes sense – hopefully my code will explain what I’m trying to do).

This works in IE9, Firefox and Chrome, but not in IE7 (which a lot of people in my organization who are still on XP currently use).

The code isn’t the most elegant thing I’ve ever written, but I need to fix this before demoing it in front of people tomorrow! (So I’m willing to consider anything, even if it’s a quick and dirty fix at this point!)

Thanks!

for (var e = 0; e < editForm.elements.length; e++) {
    // Increment 'add row' buttons so that they add underneath the correct row
    if (editForm.elements[e].name.length >= 4) {
        if (editForm.elements[e].name.substr(0, 4) == 'add_') {
            stringPos = editForm.elements[e].name.indexOf('_');
            currentQuestionNumber = editForm.elements[e].name.substr(stringPos + 1);
            if (currentQuestionNumber > pos) {
                editForm.elements[e].name = 'add_' + (parseInt(currentQuestionNumber) + 1);
                editForm.elements[e].id = 'add_' + (parseInt(currentQuestionNumber) + 1);
                editForm.elements[e].setAttribute("onclick", "addRow(" + (parseInt(currentQuestionNumber) + 1) + ");");
            }
        }
    }

In place of…

editForm.elements[e].name = 'add_' + (parseInt(currentQuestionNumber) + 1);

…I have also used…

editForm.elements[e].setAttribute("name", "add_" + (parseInt(currentQuestionNumber) + 1));

…but this doesn’t work in IE7 either. Any help appreciated.

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:18:57+00:00Added an answer on May 25, 2026 at 2:18 pm

    In case the elements you’re changing names have been dynamically created, you may be hitting an IE6/7 bug. There’s a pointer to a possible workaround to the setAttribute bug on the Web Bug Track blog. You may also find the answers to “Changing name attr of cloned input element in jQuery doesn’t work in IE6/7” useful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div inside of a table which is inside of a form
I have a small form inside a table. POSTing that form creates a new
I have a javascript link which I need to appear in a table on
I have a HTML table inside which I have a submit button. Now, I
I have a table that contains form elements that I need to replace if
I have table inside a div tab. The table has 40 rows in it
i have table unser it i have one td with elemets inside the menu
I have a table with an image inside: <table style=border: 3px solid rgb(0, 0,
How to filter DataView/DataTable by time? I have a table with datetime column inside
I have a span element inside a table td element. The span tag has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.