Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Location
    laredo
    Posts
    303

    input box with arrays and date picker

    Hello all,

    I am creating a program where the user picks a date using a datePicker and the date goes into its textbox.

    I am allowing the user to add as many date boxes and datePicker buttons as they want dynamically

    I then will use the foreach function using PHP to take care of what is submitted.

    My problem is the datePicker. When I click on any of the added datePicker buttons the date gets inserted in the same first box anyways. I understand that this is because all the boxes have the same name.

    How can I overcome this? I tired adding the "i" variable (from the .js incrementation) within the brakets but that didn't work.

    Here is the piece of code.


    HTML Code:
    <input type="text" name="substitue_one_date[]" size="10">
    <a  onclick="displayDatePicker('substitue_one_date[]');">&nbsp;<img src="images/calendar.png" border="0"/></a>

  2. #2
    We can't see the JS that adds the boxes, so can't help you.

  3. #3
    Join Date
    Jul 2003
    Location
    laredo
    Posts
    303
    This is the js


    HTML Code:
     
    <HTML> 
    <HEAD> 
    <TITLE> Add/Remove dynamic rows in HTML table </TITLE> 
    <SCRIPT language="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; 
    } 
    } 
    } 
    function deleteRow(tableID) { 
    try { 
    var table = document.getElementById(tableID); 
    var rowCount = table.rows.length; 
    for(var i=0; i<rowCount; i++) { 
    var row = table.rows[i]; 
    var chkbox = row.cells[0].childNodes[0]; 
    if(null != chkbox && true == chkbox.checked) { 
    if(rowCount <= 1) { 
    alert("Cannot delete all the rows."); 
    break; 
    } 
    table.deleteRow(i); 
    rowCount--; 
    i--; 
    } 
    } 
    }catch(e) { 
    alert(e); 
    } 
    } 
    </SCRIPT> 
    </HEAD> 
     

Similar Threads

  1. Looking for jquery/mootools coder for a date picker.
    By Varcoe in forum Employment / Job Offers
    Replies: 1
    Last Post: 03-20-2010, 03:31 AM
  2. javascript date picker wrong format
    By bambinou in forum Programming Discussion
    Replies: 4
    Last Post: 10-11-2009, 01:15 PM
  3. js date picker
    By Snargleflap in forum Programming Discussion
    Replies: 3
    Last Post: 08-04-2009, 01:48 PM
  4. Need input on new box
    By blueface in forum Colocation and Data Centers
    Replies: 14
    Last Post: 12-03-2005, 04:30 PM
  5. date picker
    By stephenvs in forum Programming Discussion
    Replies: 1
    Last Post: 06-18-2004, 07:10 AM

Posting Permissions

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