Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Clone node not cloning my select options...

Posted on 2006-11-28
14
434 Views
Last Modified: 2008-01-09
Hi Again,

I have the following that is called from a button in the row to be cloned.

'<input type="BUTTON" value="Split" onClick="javascript:bc_SplitTableRow(this);">' " "

<script>
function bc_SplitTableRow(theLink){
  theRow = theLink.parentNode.parentNode;
  newRow = theRow.cloneNode(true);
  theRow.parentNode.insertBefore(newRow, theRow.nextSibling);
  return false;
}
</script>

The above creates the new row and clones the text items but does not set the select to the cloned values... ???
How do I do this?

0
Comment
Question by:bcarlis
  • 9
  • 4
14 Comments
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 18032451
0
 
LVL 2

Author Comment

by:bcarlis
ID: 18032834
R.K.
That is adding files and couldn't see clearly where it clones select lists... ???

Thank you Bill
0
 
LVL 17

Expert Comment

by:gops1
ID: 18033380
Here is one. Try it out:

<html>
      <head>
            <title>Script Demo Gops</title>
            <head>
                  <script type="text/javascript">
                        function bc_SplitTableRow(theLink){

                              theRow = theLink.parentNode.parentNode;
                              theTable=theRow.parentNode;
                              newRow = theRow.cloneNode(true);
                              theRow.parentNode.insertBefore(newRow, theRow.nextSibling);
                              var parentSelect=theRow.cells[1].childNodes[0].selectedIndex;
                              var newR=theRow.parentNode.rows.length-1;
                              theTable.rows[newR].cells[1].childNodes[0].selectedIndex=parentSelect;
                              return false;
                        }
                  </script>
            </head>
<body>
      <table border="0" cellspacing="2" cellpadding="2">
            <tr>
                  <td><input type="text" size="10" name="txt"></td>
                  <td>
                        <select name="selc">
                              <option>A
                              <option>B
                        </select>
                  </td>
                  <td><input type="button" value="Split" onClick="javascript:bc_SplitTableRow(this);"></td>
            </tr>
      </table>
</body>
</html>
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 2

Author Comment

by:bcarlis
ID: 18033725
Hi Gosp1,

I tried the below and it still didn't clone the selects.

   function bc_SplitTableRow(theLink){

       theRow = theLink.parentNode.parentNode;
       theTable=theRow.parentNode;
       newRow = theRow.cloneNode(true);
       theRow.parentNode.insertBefore(newRow, theRow.nextSibling);
       var parentSelect=theRow.cells[1].childNodes[0].selectedIndex;
       var newR=theRow.parentNode.rows.length-1;
       theTable.rows[newR].cells[1].childNodes[0].selectedIndex=parentSelect;
       return false;
    }

Bill
0
 
LVL 17

Expert Comment

by:gops1
ID: 18033811
Not a problem Bill, I need to see your table structure and find a fix for it.
0
 
LVL 2

Author Comment

by:bcarlis
ID: 18034118
Yes, I see... here is your example with 2 additions:


<html>
     <head>
          <title>Script Demo Gops</title>
          <head>
               <script type="text/javascript">
                    function bc_SplitTableRow(theLink){

                         theRow = theLink.parentNode.parentNode;
                         theTable=theRow.parentNode;
                         newRow = theRow.cloneNode(true);
                         theRow.parentNode.insertBefore(newRow, theRow.nextSibling);
                         var parentSelect=theRow.cells[1].childNodes[0].selectedIndex;
                         var newR=theRow.parentNode.rows.length-1;
                         theTable.rows[newR].cells[1].childNodes[0].selectedIndex=parentSelect;
                         return false;
                    }
               </script>
          </head>
<body>
     <table border="0" cellspacing="2" cellpadding="2">
          <tr>
               <td><input type="text" size="10" name="txt"></td>
               <td>
                    <select name="selc1">
                         <option>A
                         <option>B
                    </select>
               </td>
               <td>
                    <select name="selc2">
                         <option>p
                         <option>m
                    </select>
               </td>
               <td>
                    <select name="selc3">
                         <option>4
                         <option>5
                    </select>
               </td>
               <td><input type="button" value="Split"
               onClick="javascript:bc_SplitTableRow(this);"></td>
          </tr>
     </table>
</body>
</html>
0
 
LVL 17

Expert Comment

by:gops1
ID: 18035411
Have a look at this:

<html>
      <head>
            <title>Script Demo Gops</title>
            <script type="text/javascript">
                  function bc_SplitTableRow(theLink){
                        theRow = theLink.parentNode.parentNode;
                        theTable=theRow.parentNode;
                        newRow = theRow.cloneNode(true);
                        theRow.parentNode.insertBefore(newRow, theRow.nextSibling);

                        var newR=theRow.parentNode.rows.length-1;
                        for(i=0;i<theRow.cells.length;i++){
                              if(theRow.cells[i].childNodes[0].type=="select-one"){
                                    var parentSelect=theRow.cells[i].childNodes[0].selectedIndex;
                                    theTable.rows[newR].cells[i].childNodes[0].selectedIndex=parentSelect;
                              }
                        }
                        return false;
                  }
            </script>
      </head>
<body>
      <table border="0" cellspacing="2" cellpadding="2">
            <tr>
                  <td><input type="text" size="10" name="txt"></td>
                  <td>
                        <select name="selc1">
                              <option>A
                              <option>B
                        </select>
                  </td>
                  <td>
                        <select name="selc2">
                              <option>p
                              <option>m
                        </select>
                  </td>
                  <td>
                        <select name="selc3">
                              <option>4
                              <option>5
                        </select>
                  </td>
                  <td><input type="button" value="Split" onClick="javascript:bc_SplitTableRow(this);"></td>
          </tr>
     </table>
</body>
</html>
0
 
LVL 17

Accepted Solution

by:
gops1 earned 400 total points
ID: 18035454
There is a minor change in the function.

Change the entire funtion with this:

                  function bc_SplitTableRow(theLink){
                        theRow = theLink.parentNode.parentNode;
                        theTable=theRow.parentNode;
                        newRow = theRow.cloneNode(true);
                        var newR=theRow.parentNode.insertBefore(newRow, theRow.nextSibling);


                        for(i=0;i<theRow.cells.length;i++){
                              if(theRow.cells[i].childNodes[0].type=="select-one"){
                                    var parentSelect=theRow.cells[i].childNodes[0].selectedIndex;
                                    theTable.rows[newR.rowIndex].cells[i].childNodes[0].selectedIndex=parentSelect;
                              }
                        }
                        return false;
                  }
0
 
LVL 2

Author Comment

by:bcarlis
ID: 18036545
Gops1,

I tested the example and it works great!
BUT, I inserted it into my page and it doesn't work.... I played a bit with it put no luck...



<html>
     <head>
        <title>Script Demo Gops</title>
<body>
<script type="text/javascript">
function bc_SplitTableRow(theLink){
    theRow = theLink.parentNode.parentNode;
    theTable=theRow.parentNode;
    newRow = theRow.cloneNode(true);
    var newR=theRow.parentNode.insertBefore(newRow, theRow.nextSibling);

    for(i=0;i<theRow.cells.length;i++){
       if(theRow.cells[i].childNodes[0].type=="select-one"){
            var parentSelect=theRow.cells[i].childNodes[0].selectedIndex;
            theTable.rows[newR.rowIndex].cells[i].childNodes[0].selectedIndex=parentSelect;
       }
    }
    return false;
}

</script>
<table align="center" cellpadding="0" border="1" bordercolor="black" cellspacing="0" summary=""><tr><td></td></tr>
<tr>
<td><table cellpadding="0" border="0" cellspacing="0" summary="" class="t2standard">
<tr ><th id="CHECK$01" class="t2header"><label for="x01" class="hideMe508">Check All</label><input type="checkbox" name="x02" value="1" onclick="checkAll(this)" /></th><th id="START_DATE" class="t2header">Start Date</th><th id="BEGIN_TIME" class="t2header">Begin Time</th><th id="END_TIME" class="t2header">End Time</th><th id="SESSION_TITLE" class="t2header">Session Title</th><th id="ASSIGNED_RM" class="t2header">Assigned Rm</th><th id=" " class="t2header"> </th></tr>
<tr onmouseover="row_mouse_over8386918256913573(this, 1)" onmouseout="row_mouse_out8386918256913573(this, 1)"><td headers="CHECK$01" class="t2data"><label for="f01_0001" class="hideMe508">CHECK$01</label><input type="checkbox" name="f01" value="1" onclick="highlight_row(this,1)" id="f01_0001" /></td><td headers="START_DATE" class="t2data"><span class="lov"><input type="text" name="f04" size="15" maxlength="2000" value="29-NOV-2006"  style="padding-right:5px;" id="f04_0001" /><script type="text/javascript">
<!--

          function genCalf04_0()
     {
       elemArrLen = 0;
       if (document.forms[0].f04.length) {
         elemArrLen = document.forms[0].f04.length;
       }

       w = open("wwv_flow_utilities.show_as_popup_calendar" +
                   "?p_element_index=" + escape('f04'  + '['.substr(0,elemArrLen) +'0'.substr(0,elemArrLen) + ']'.substr(0,elemArrLen)) +
                   "&p_form_index=" + escape('0') +
                   "&p_date_format=" + escape('DD-MON-YYYY') +
                   "&p_application_format=" + escape('Y') +
                   "&p_bgcolor=" + escape('#666666') +
                   "&p_dd=" + escape('') +
                   "&p_hh=" + escape('') +
                   "&p_mi=" + escape('') +
                   "&p_pm=" + escape('') +
                   "&p_yyyy=" + escape('2006') +
                   "&p_lang=" + escape('en-us') +
                   "&p_mm=" + escape('11'),
                   "winLov",
                   "Scrollbars=no,resizable=no,width=258,height=210");

       if (w.opener == null)
         w.opener = self;
       w.focus();
     }
//-->
</script><a  href="javascript:genCalf04_0()"><img src="/i/asfdcldr.gif" align="middle" alt="Calendar"/></span></a></td><td headers="BEGIN_TIME" class="t2data"><label for="f05_0001" class="hideMe508">BEGIN_TIME</label><select name="f05"  id="f05_0001"><option value="">- Select -</option><option value="08:00" >8:00 AM</option><option value="08:30" >8:30 AM</option><option value="09:00" >9:00 AM</option><option value="09:30" >9:30 AM</option><option value="10:00" selected="selected">10:00 AM</option><option value="10:30" >10:30 AM</option><option value="11:00" >11:00 AM</option><option value="11:30" >11:30 AM</option><option value="12:00" >12:00 PM</option><option value="12:30" >12:30 PM</option><option value="13:00" >1:00 PM</option><option value="13:30" >1:30 PM</option><option value="14:00" >2:00 PM</option><option value="14:30" >2:30 PM</option><option value="15:00" >3:00 PM</option><option value="15:30" >3:30 PM</option><option value="16:00" >4:00 PM</option><option value="16:30" >4:30 PM</option><option value="17:00" >5:00 PM</option><option value="17:30" >5:30 PM</option><option value="18:00" >6:00 PM</option><option value="18:30" >6:30 PM</option><option value="19:00" >7:00 PM</option><option value="19:30" >7:30 PM</option><option value="20:00" >8:00 PM</option><option value="20:30" >8:30 PM</option><option value="21:00" >9:00 PM</option><option value="21:30" >9:30 PM</option><option value="22:00" >10:00 PM</option></select></td><td headers="END_TIME" class="t2data"><label for="f06_0001" class="hideMe508">END_TIME</label><select name="f06"  id="f06_0001"><option value="">- Select -</option><option value="08:00" >8:00 AM</option><option value="08:30" >8:30 AM</option><option value="09:00" >9:00 AM</option><option value="09:30" >9:30 AM</option><option value="10:00" selected="selected">10:00 AM</option><option value="10:30" >10:30 AM</option><option value="11:00" >11:00 AM</option><option value="11:30" >11:30 AM</option><option value="12:00" >12:00 PM</option><option value="12:30" >12:30 PM</option><option value="13:00" >1:00 PM</option><option value="13:30" >1:30 PM</option><option value="14:00" >2:00 PM</option><option value="14:30" >2:30 PM</option><option value="15:00" >3:00 PM</option><option value="15:30" >3:30 PM</option><option value="16:00" >4:00 PM</option><option value="16:30" >4:30 PM</option><option value="17:00" >5:00 PM</option><option value="17:30" >5:30 PM</option><option value="18:00" >6:00 PM</option><option value="18:30" >6:30 PM</option><option value="19:00" >7:00 PM</option><option value="19:30" >7:30 PM</option><option value="20:00" >8:00 PM</option><option value="20:30" >8:30 PM</option><option value="21:00" >9:00 PM</option><option value="21:30" >9:30 PM</option><option value="22:00" >10:00 PM</option></select></td><td headers="SESSION_TITLE" class="t2data"><label for="f08_0001" class="hideMe508">SESSION_TITLE</label><input type="text" name="f08" size="16" maxlength="2000" value="TEST20116633"  id="f08_0001" /></td><td headers="ASSIGNED_RM" class="t2data"><label for="f07_0001" class="hideMe508">ASSIGNED_RM</label><select name="f07"  id="f07_0001"><option value="">- Select -</option><option value="1" >Atascosa</option><option value="2" >Atascosa/Bandera</option><option value="3" >Atascosa/Bandera/Bexar</option><option value="4" >Atascosa/Bandera/Bexar/Dimmit</option><option value="5" >Atascosa/Bandera/Bexar/Dimmit/Frio</option><option value="6" >Atascosa/Bandera/Bexar/Dimmit/Frio/Kendal</option><option value="7" >Bandera</option><option value="8" >Bandera/Bexar</option><option value="9" selected="selected">Bandera/Bexar/Dimmit</option><option value="10" >Bandera/Bexar/Dimmit/Frio</option><option value="11" >Bandera/Bexar/Dimmit/Frio/Kendal</option><option value="12" >Bexar</option><option value="13" >Bexar/Dimmit</option><option value="14" >Bexar/Dimmit/Frio</option><option value="15" >Bexar/Dimmit/Frio/Kendal</option><option value="16" >Dimmit</option><option value="17" >Frio</option><option value="18" >Frio/Bexar</option><option value="19" >Frio/Bexar/Kendal</option><option value="20" >Frio/Kendall</option><option value="21" >Kendall</option><option value="22" >Kinney</option><option value="23" >Kinney/Kerr</option><option value="24" >Kerr</option><option value="25" >LaSalle</option><option value="26" >LaSalle/Medina</option><option value="27" >Medina</option><option value="28" >Maverick</option><option value="29" >Maverick/Real</option><option value="30" >Real</option><option value="31" >Wilson</option><option value="32" >Wilson/Zavala/Uvalde</option><option value="33" >Uvalde</option><option value="34" >Uvalde/Zavala</option><option value="35" >Zavala</option><option value="36" >Cedar</option><option value="37" >Cottonwood</option><option value="38" >Cypress</option><option value="39" >Elem</option><option value="40" >Hickory</option><option value="41" >Hickory/Laurel</option><option value="42" >Hickory/Laurel/Magnolia</option><option value="43" >Laurel</option><option value="44" >Laurel/Magnolia</option><option value="45" >Magnolia</option><option value="46" >Maple</option><option value="47" >Maple/Mesquite</option><option value="48" >Maple/Mesquite/Oak</option><option value="49" >Maple/Mesquite/Oak/Pecan</option><option value="50" >Mesquite</option><option value="51" >Mesquite/Oak</option><option value="52" >Mesquite/Oak/Pecan</option><option value="53" >Oak</option><option value="54" >Oak/Pecan</option><option value="55" >Pine</option><option value="56" >Redbud</option></select></td><td headers=" " class="t2data"><input type="BUTTON" value="Split" onClick="javascript:bc_SplitTableRow(this);"><input type="hidden" name="f02" value="1" /><input type="hidden" name="f03" value="2" /><input type="hidden" name="fcs" value="3AFE9BC73A08E37CE198929F0D1F250D" /></td></tr><tr onmouseover="row_mouse_over8386918256913573(this, 2)" onmouseout="row_mouse_out8386918256913573(this, 2)"><td headers="CHECK$01" class="t2data"><label for="f01_0002" class="hideMe508">CHECK$01</label><input type="checkbox" name="f01" value="2" onclick="highlight_row(this,2)" id="f01_0002" /></td><td headers="START_DATE" class="t2data"><span class="lov"><input type="text" name="f04" size="15" maxlength="2000" value="30-NOV-2006"  style="padding-right:5px;" id="f04_0002" /><script type="text/javascript">
<!--

          function genCalf04_1()
     {
       elemArrLen = 0;
       if (document.forms[0].f04.length) {
         elemArrLen = document.forms[0].f04.length;
       }

       w = open("wwv_flow_utilities.show_as_popup_calendar" +
                   "?p_element_index=" + escape('f04'  + '['.substr(0,elemArrLen) +'1'.substr(0,elemArrLen) + ']'.substr(0,elemArrLen)) +
                   "&p_form_index=" + escape('0') +
                   "&p_date_format=" + escape('DD-MON-YYYY') +
                   "&p_application_format=" + escape('Y') +
                   "&p_bgcolor=" + escape('#666666') +
                   "&p_dd=" + escape('') +
                   "&p_hh=" + escape('') +
                   "&p_mi=" + escape('') +
                   "&p_pm=" + escape('') +
                   "&p_yyyy=" + escape('2006') +
                   "&p_lang=" + escape('en-us') +
                   "&p_mm=" + escape('11'),
                   "winLov",
                   "Scrollbars=no,resizable=no,width=258,height=210");

       if (w.opener == null)
         w.opener = self;
       w.focus();
     }
//-->
</script><a  href="javascript:genCalf04_1()"><img src="/i/asfdcldr.gif" align="middle" alt="Calendar"/></span></a></td><td headers="BEGIN_TIME" class="t2data"><label for="f05_0002" class="hideMe508">BEGIN_TIME</label><select name="f05"  id="f05_0002"><option value="">- Select -</option><option value="08:00" >8:00 AM</option><option value="08:30" >8:30 AM</option><option value="09:00" >9:00 AM</option><option value="09:30" >9:30 AM</option><option value="10:00" >10:00 AM</option><option value="10:30" >10:30 AM</option><option value="11:00" >11:00 AM</option><option value="11:30" >11:30 AM</option><option value="12:00" >12:00 PM</option><option value="12:30" >12:30 PM</option><option value="13:00" >1:00 PM</option><option value="13:30" >1:30 PM</option><option value="14:00" >2:00 PM</option><option value="14:30" selected="selected">2:30 PM</option><option value="15:00" >3:00 PM</option><option value="15:30" >3:30 PM</option><option value="16:00" >4:00 PM</option><option value="16:30" >4:30 PM</option><option value="17:00" >5:00 PM</option><option value="17:30" >5:30 PM</option><option value="18:00" >6:00 PM</option><option value="18:30" >6:30 PM</option><option value="19:00" >7:00 PM</option><option value="19:30" >7:30 PM</option><option value="20:00" >8:00 PM</option><option value="20:30" >8:30 PM</option><option value="21:00" >9:00 PM</option><option value="21:30" >9:30 PM</option><option value="22:00" >10:00 PM</option></select></td><td headers="END_TIME" class="t2data"><label for="f06_0002" class="hideMe508">END_TIME</label><select name="f06"  id="f06_0002"><option value="">- Select -</option><option value="08:00" >8:00 AM</option><option value="08:30" >8:30 AM</option><option value="09:00" >9:00 AM</option><option value="09:30" >9:30 AM</option><option value="10:00" >10:00 AM</option><option value="10:30" >10:30 AM</option><option value="11:00" >11:00 AM</option><option value="11:30" >11:30 AM</option><option value="12:00" selected="selected">12:00 PM</option><option value="12:30" >12:30 PM</option><option value="13:00" >1:00 PM</option><option value="13:30" >1:30 PM</option><option value="14:00" >2:00 PM</option><option value="14:30" >2:30 PM</option><option value="15:00" >3:00 PM</option><option value="15:30" >3:30 PM</option><option value="16:00" >4:00 PM</option><option value="16:30" >4:30 PM</option><option value="17:00" >5:00 PM</option><option value="17:30" >5:30 PM</option><option value="18:00" >6:00 PM</option><option value="18:30" >6:30 PM</option><option value="19:00" >7:00 PM</option><option value="19:30" >7:30 PM</option><option value="20:00" >8:00 PM</option><option value="20:30" >8:30 PM</option><option value="21:00" >9:00 PM</option><option value="21:30" >9:30 PM</option><option value="22:00" >10:00 PM</option></select></td><td headers="SESSION_TITLE" class="t2data"><label for="f08_0002" class="hideMe508">SESSION_TITLE</label><input type="text" name="f08" size="16" maxlength="2000" value="test1122"  id="f08_0002" /></td><td headers="ASSIGNED_RM" class="t2data"><label for="f07_0002" class="hideMe508">ASSIGNED_RM</label><select name="f07"  id="f07_0002"><option value="">- Select -</option><option value="1" >Atascosa</option><option value="2" >Atascosa/Bandera</option><option value="3" >Atascosa/Bandera/Bexar</option><option value="4" >Atascosa/Bandera/Bexar/Dimmit</option><option value="5" >Atascosa/Bandera/Bexar/Dimmit/Frio</option><option value="6" >Atascosa/Bandera/Bexar/Dimmit/Frio/Kendal</option><option value="7" >Bandera</option><option value="8" >Bandera/Bexar</option><option value="9" selected="selected">Bandera/Bexar/Dimmit</option><option value="10" >Bandera/Bexar/Dimmit/Frio</option><option value="11" >Bandera/Bexar/Dimmit/Frio/Kendal</option><option value="12" >Bexar</option><option value="13" >Bexar/Dimmit</option><option value="14" >Bexar/Dimmit/Frio</option><option value="15" >Bexar/Dimmit/Frio/Kendal</option><option value="16" >Dimmit</option><option value="17" >Frio</option><option value="18" >Frio/Bexar</option><option value="19" >Frio/Bexar/Kendal</option><option value="20" >Frio/Kendall</option><option value="21" >Kendall</option><option value="22" >Kinney</option><option value="23" >Kinney/Kerr</option><option value="24" >Kerr</option><option value="25" >LaSalle</option><option value="26" >LaSalle/Medina</option><option value="27" >Medina</option><option value="28" >Maverick</option><option value="29" >Maverick/Real</option><option value="30" >Real</option><option value="31" >Wilson</option><option value="32" >Wilson/Zavala/Uvalde</option><option value="33" >Uvalde</option><option value="34" >Uvalde/Zavala</option><option value="35" >Zavala</option><option value="36" >Cedar</option><option value="37" >Cottonwood</option><option value="38" >Cypress</option><option value="39" >Elem</option><option value="40" >Hickory</option><option value="41" >Hickory/Laurel</option><option value="42" >Hickory/Laurel/Magnolia</option><option value="43" >Laurel</option><option value="44" >Laurel/Magnolia</option><option value="45" >Magnolia</option><option value="46" >Maple</option><option value="47" >Maple/Mesquite</option><option value="48" >Maple/Mesquite/Oak</option><option value="49" >Maple/Mesquite/Oak/Pecan</option><option value="50" >Mesquite</option><option value="51" >Mesquite/Oak</option><option value="52" >Mesquite/Oak/Pecan</option><option value="53" >Oak</option><option value="54" >Oak/Pecan</option><option value="55" >Pine</option><option value="56" >Redbud</option></select></td><td headers=" " class="t2data"><input type="BUTTON" value="Split" onClick="javascript:bc_SplitTableRow(this);"><input type="hidden" name="f02" value="2" /><input type="hidden" name="f03" value="2" /><input type="hidden" name="fcs" value="1AD5B4D9FFCAF5403ECEFC205A82CAE0" /></td></tr></table><div class="t2CVS"></div></td>
</tr>
<tr><td colspan="10" align="right" ><table summary=""><tr><td class="pagination"></td><td class="pagination"></td><td nowrap="nowrap" class="pagination"><span class="fielddata">1 - 2</span></td><td class="pagination"></td><td class="pagination"></td></tr></table></td></tr>
</table>
</body>
</html>
0
 
LVL 2

Author Comment

by:bcarlis
ID: 18036565
Gops1,

I just realized! Your example doesn't use the VALUE

<select name="selc1">
 <option>A
 <option>B
</select>

<select name="selc1">
<option value="26" >LaSalle/Medina</option>
<option value="27" >Medina</option>
<option value="28" >Maverick</option>
<option value="29" >Maverick/Real</option>
<option value="30" >Real</option
</select>


0
 
LVL 2

Author Comment

by:bcarlis
ID: 18036720

I reduced the example of my page down to 3 selects ...  and it is not working...


<html>
     <head>
        <title>Script Demo Gops</title>
        <head>
             <script type="text/javascript">
function bc_SplitTableRow(theLink){
    theRow = theLink.parentNode.parentNode;
    theTable=theRow.parentNode;
    newRow = theRow.cloneNode(true);
    var newR=theRow.parentNode.insertBefore(newRow, theRow.nextSibling);

    for(i=0;i<theRow.cells.length;i++){
      if(theRow.cells[i].childNodes[0].type=="select-one"){
           var parentSelect=theRow.cells[i].childNodes[0].selectedIndex;
           theTable.rows[newR.rowIndex].cells[i].childNodes[0].selectedIndex=parentSelect;
      }
    }
    return false;
}
             </script>
        </head>
<body>
     <table border="0" cellspacing="2" cellpadding="2">
        <tr>
             <td><input type="text" size="10" name="txt"></td>

<td headers="ASSIGNED_RM1" class="t2data">
<label for="f07_0001" class="hideMe508">ASSIGNED_RM</label>
<select name="f07" id="f07_0001">
<option value="">- Select -</option>
<option value="1" >Atascosa</option>
<option value="2" >Atascosa/Bandera</option>
<option value="3" >Atascosa/Bandera/Bexar</option>
<option value="4" >Atascosa/Bandera/Bexar/Dimmit</option>
<option value="5" >Atascosa/Bandera/Bexar/Dimmit/Frio</option>
<option value="6" >Atascosa/Bandera/Bexar/Dimmit/Frio/Kendal</option>
<option value="7" >Bandera</option>
<option value="8" >Bandera/Bexar</option>
<option value="9" selected="selected">Bandera/Bexar/Dimmit</option>
<option value="10" >Bandera/Bexar/Dimmit/Frio</option>
<option value="11" >Bandera/Bexar/Dimmit/Frio/Kendal</option>
<option value="12" >Bexar</option>
<option value="13" >Bexar/Dimmit</option>
<option value="14" >Bexar/Dimmit/Frio</option>
<option value="15" >Bexar/Dimmit/Frio/Kendal</option>
<option value="16" >Dimmit</option>
<option value="17" >Frio</option>
<option value="18" >Frio/Bexar</option>
<option value="19" >Frio/Bexar/Kendal</option>
<option value="20" >Frio/Kendall</option>
<option value="21" >Kendall</option>
<option value="22" >Kinney</option>
<option value="23" >Kinney/Kerr</option>
<option value="24" >Kerr</option>
<option value="25" >LaSalle</option>
<option value="26" >LaSalle/Medina</option>
<option value="56" >Redbud</option>
</select>
</td>
<td headers="ASSIGNED_RM2" class="t2data">
<label for="f07_0002" class="hideMe508">ASSIGNED_RM</label>
<select name="f07" id="f07_0002">
<option value="">- Select -</option>
<option value="1" >Atascosa</option>
<option value="2" >Atascosa/Bandera</option>
<option value="3" >Atascosa/Bandera/Bexar</option>
<option value="4" >Atascosa/Bandera/Bexar/Dimmit</option>
<option value="5" >Atascosa/Bandera/Bexar/Dimmit/Frio</option>
<option value="6" >Atascosa/Bandera/Bexar/Dimmit/Frio/Kendal</option>
<option value="7" >Bandera</option>
<option value="8" >Bandera/Bexar</option>
<option value="9" selected="selected">Bandera/Bexar/Dimmit</option>
<option value="10" >Bandera/Bexar/Dimmit/Frio</option>
<option value="11" >Bandera/Bexar/Dimmit/Frio/Kendal</option>
<option value="12" >Bexar</option>
<option value="13" >Bexar/Dimmit</option>
<option value="14" >Bexar/Dimmit/Frio</option>
<option value="15" >Bexar/Dimmit/Frio/Kendal</option>
<option value="16" >Dimmit</option>
<option value="17" >Frio</option>
<option value="18" >Frio/Bexar</option>
<option value="19" >Frio/Bexar/Kendal</option>
<option value="20" >Frio/Kendall</option>
<option value="21" >Kendall</option>
<option value="22" >Kinney</option>
<option value="23" >Kinney/Kerr</option>
<option value="24" >Kerr</option>
<option value="25" >LaSalle</option>
<option value="26" >LaSalle/Medina</option>
<option value="56" >Redbud</option>
</select>
</td>
<td headers="ASSIGNED_RM3" class="t2data">
<label for="f07_0003" class="hideMe508">ASSIGNED_RM</label>
<select name="f07" id="f07_0003">
<option value="">- Select -</option>
<option value="1" >Atascosa</option>
<option value="2" >Atascosa/Bandera</option>
<option value="3" >Atascosa/Bandera/Bexar</option>
<option value="4" >Atascosa/Bandera/Bexar/Dimmit</option>
<option value="5" >Atascosa/Bandera/Bexar/Dimmit/Frio</option>
<option value="6" >Atascosa/Bandera/Bexar/Dimmit/Frio/Kendal</option>
<option value="7" >Bandera</option>
<option value="8" >Bandera/Bexar</option>
<option value="9" selected="selected">Bandera/Bexar/Dimmit</option>
<option value="10" >Bandera/Bexar/Dimmit/Frio</option>
<option value="11" >Bandera/Bexar/Dimmit/Frio/Kendal</option>
<option value="12" >Bexar</option>
<option value="13" >Bexar/Dimmit</option>
<option value="14" >Bexar/Dimmit/Frio</option>
<option value="15" >Bexar/Dimmit/Frio/Kendal</option>
<option value="16" >Dimmit</option>
<option value="17" >Frio</option>
<option value="18" >Frio/Bexar</option>
<option value="19" >Frio/Bexar/Kendal</option>
<option value="20" >Frio/Kendall</option>
<option value="21" >Kendall</option>
<option value="22" >Kinney</option>
<option value="23" >Kinney/Kerr</option>
<option value="24" >Kerr</option>
<option value="25" >LaSalle</option>
<option value="26" >LaSalle/Medina</option>
<option value="56" >Redbud</option>
</select>
</td>
             <td><input type="button" value="Split" onClick="javascript:bc_SplitTableRow(this);"></td>
        </tr>
     </table>
</body>
</html>
0
 
LVL 2

Author Comment

by:bcarlis
ID: 18036739

This works fine... but not the above???

<html>
     <head>
        <title>Script Demo Gops</title>
        <head>
             <script type="text/javascript">
function bc_SplitTableRow(theLink){
    theRow = theLink.parentNode.parentNode;
    theTable=theRow.parentNode;
    newRow = theRow.cloneNode(true);
    var newR=theRow.parentNode.insertBefore(newRow, theRow.nextSibling);

    for(i=0;i<theRow.cells.length;i++){
      if(theRow.cells[i].childNodes[0].type=="select-one"){
           var parentSelect=theRow.cells[i].childNodes[0].selectedIndex;
           theTable.rows[newR.rowIndex].cells[i].childNodes[0].selectedIndex=parentSelect;
      }
    }
    return false;
}
             </script>
        </head>
<body>
     <table border="0" cellspacing="2" cellpadding="2">
        <tr>
             <td><input type="text" size="10" name="txt"></td>
             <td>
                <select name="selc1">
<option value="26" >LaSalle/Medina</option>
<option value="27" >Medina</option>
<option value="28" >Maverick</option>
<option value="29" >Maverick/Real</option>
<option value="30" >Real</option>
</select>
             </td>
             <td>
                <select name="selc2">
<option value="26" >LaSalle/Medina</option>
<option value="27" >Medina</option>
<option value="28" >Maverick</option>
<option value="29" >Maverick/Real</option>
<option value="30" >Real</option>
</select>
             </td>
             <td>
                <select name="selc3">
<option value="26" >LaSalle/Medina</option>
<option value="27" >Medina</option>
<option value="28" >Maverick</option>
<option value="29" >Maverick/Real</option>
<option value="30" >Real</option>
                </select>
             </td>
             <td><input type="button" value="Split" onClick="javascript:bc_SplitTableRow(this);"></td>
        </tr>
     </table>
</body>
</html>
0
 
LVL 2

Author Comment

by:bcarlis
ID: 18036764
Gops1,

I took the <label for="f07_0003" class="hideMe508">ASSIGNED_RM</label>
off each select and it works fine..

I am using Oracle Application Express and don't know where that comes from.... any ideas?

Thank you, Bill


0
 
LVL 2

Author Comment

by:bcarlis
ID: 18037234
Gops1,

On Mozilla it works fine...

I have Oracle looking into it...

Thanks for all your help! Bill
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how can i get the string decoded ? 2 28
innerHTML 7 34
JavaScript to set default value on SharePoint form field 7 19
How to make google charts responsive 4 3
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question