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

  • Home
  • SEARCH
  • 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 6952563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:21:55+00:00 2026-05-27T14:21:55+00:00

I have a web form which has dynamic table using repeating rows. New rows

  • 0

I have a web form which has dynamic table using repeating rows. New rows are added by calling the addRow function below:

function addRow(tableID) {

        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;
        var row = table.insertRow(rowCount);
        var colCount = table.rows[0].cells.length;

        for(var i=0; i<colCount; i++) {


            var newcell = row.insertCell(i);

            newcell.innerHTML = table.rows[0].cells[i].innerHTML;
            //alert(newcell.childNodes);
            switch(newcell.childNodes[0].type) {
                case "text":
                        newcell.childNodes[0].value = "";
                        break;
                case "checkbox":
                        newcell.childNodes[0].checked = false;
                        break;
                case "select-one":
                        newcell.childNodes[0].selectedIndex = 0;
                        break;
            }

I would like one datepicker (or more) in each row. Datepicker from here:
http://www.frequency-decoder.com/2011/10/11/unobtrusive-accessible-datepicker-widgit-v6

I need the following script for each datepicker:

<script>
datePickerController.createDatePicker({ 
// Associate the text input to a DD/MM/YYYY date format                            
formElements:{"formInputName":"%Y-%m-%d"}
}); 
</script> 

How can I easily execute this script for each table row that is added? I’m aware that using in innerHTML does not work. Please see the attached image for the desired result.

https://i.stack.imgur.com/HHn2w.jpg

Thanks for your help!

  • 1 1 Answer
  • 0 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-27T14:21:56+00:00Added an answer on May 27, 2026 at 2:21 pm

    You could create id’s for each of the inputs you create and also use a class to show which input should use the date picker …

    Working demo here -> http://jsfiddle.net/S8Vky/3/

    Example :

    HTML

    <table id="mytable">
        <tr>
            <td><input class="text" type="text" id="row-0-0" value=""/></td>
            <td><input class="cal" type="text" id="row-0-1" value=""/></td>
            <td><input class="cal" type="text" id="row-0-2" value=""/></td>
        </tr>
    </table>
    <input type="button" onclick="addRow('mytable')" value="Add Row"/>
    

    JavaScript

    function addRow(tableID) {
    
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;
        var row = table.insertRow(rowCount);
        var colCount = table.rows[0].cells.length;
        for (var i = 0; i < colCount; i++) {
            var newcell = row.insertCell(i);
            newcell.innerHTML = table.rows[0].cells[i].innerHTML;
            //alert(newcell.childNodes);
            switch (newcell.childNodes[0].type) {
            case "text":
                newcell.childNodes[0].value = "";
                break;
            case "checkbox":
                newcell.childNodes[0].checked = false;
                break;
            case "select-one":
                newcell.childNodes[0].selectedIndex = 0;
                break;
            }
    
            var newrowid = "row-" + rowCount + "-" + i;
            newcell.childNodes[0].id = newrowid;
            var obj = {};
            obj[newrowid] = "%d/%m/%Y";
            if (newcell.childNodes[0].className == 'cal') {
                datePickerController.createDatePicker({
                    formElements: obj
                });
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web form that has 2 radio buttons, depending on which one
I have a web form which has 23 textbox's , I need to pass
I have a huge ASPX web form which has around 100 fields which need
I have a web page which has a form at the top and a
I have created a form in my web application which has only a single
I have a JSF/Seam web app which has a page with a form which,
I'm making a web page using CGI scripting which has a form users need
I have a simple web form which has a couple list boxes and a
I have an ASP.NET web form which I am adding a variable number User
I have a asp.net web form which will submit information to come as emails.

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.