<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Richard Garbutt got the problem right. That's why I was suggesting to do it like this:<DIV><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">replace:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">    if (inputFields[i].getAttribute("name") == "products_id[][products_quantity]") {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">with:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">    if (inputFields[i].getAttribute("name").substring(0,11) == "products_id") {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">But as Richard said, you can also replace </DIV><BLOCKQUOTE type="cite"><FONT class="Apple-style-span" color="#0000FF" face="Trebuchet MS" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">if (inputFields[i].getAttribute("name") == "products_id[" + i + "][products_id]") {</SPAN></FONT></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>by <BLOCKQUOTE type="cite"><FONT class="Apple-style-span" color="#0000FF" face="Trebuchet MS" size="2"><SPAN class="Apple-style-span" style="font-size: 10px;">if (inputFields[i].getAttribute("name") == "products_id[" + orderNumRows + "][products_id]") {</SPAN></FONT></BLOCKQUOTE><DIV><BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">and it should work.</DIV><DIV><DIV><DIV><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">Julien Nadeau</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><A href="mailto:junado@junado.com">junado@junado.com</A></FONT></P>  </DIV><BR><DIV><DIV>Le 05-09-28 à 04:38, Michael Borchers a écrit :</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2">function countRows() {<BR>    var ordersNumRows = 0;<BR>    var inputFields = document.getElementsByTagName("select")<BR>    var numTag = inputFields.length;<BR>    for (i=0; i&lt;numTag; i++) {<BR>        if (inputFields[i].getAttribute("name") == "products_id[" + i + "][products_id]") {<BR>            ordersNumRows++;<BR>        }<BR>    }<BR>    <BR>    alert(ordersNumRows);<BR>}<SPAN class="212433408-28092005"> </SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005"></SPAN></FONT></FONT></FONT> </DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005">actually this does work.</SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005">but the problem is:</SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005">as soon there is a different &lt;select&gt; before the selects i am searching for,</SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005">var numTag = inputFields.length; seems to stop counting:(</SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005"></SPAN></FONT></FONT></FONT> </DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005">f.e.:</SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005">&lt;select name="products_id[0][products_id]" id="products_id[0][products_id]"&gt;&lt;/select&gt;<BR>&lt;select name="products_id[1][products_id]" id="products_id[1][products_id]"&gt;&lt;/select&gt;</SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005"><SPAN class="212433408-28092005">&lt;select name="orders_status_id" id="orders_status_id"&gt;&lt;/select&gt;<BR></SPAN></SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005">= works fine, result: 2 </SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS" color="#0000ff" size="2"></FONT> </DIV> <DIV><DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005"> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005"><SPAN class="212433408-28092005">&lt;select name="orders_status_id" id="orders_status_id"&gt;&lt;/select&gt;</SPAN></SPAN></FONT></FONT></FONT></DIV></SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005">&lt;select name="products_id[0][products_id]" id="products_id[0][products_id]"&gt;&lt;/select&gt;<BR>&lt;select name="products_id[1][products_id]" id="products_id[1][products_id]"&gt;&lt;/select&gt;</SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005"><SPAN class="212433408-28092005"></SPAN></SPAN></FONT></FONT></FONT> </DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005"><SPAN class="212433408-28092005">= stops counting, result: 0</SPAN></SPAN></FONT></FONT></FONT></DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005"><SPAN class="212433408-28092005"></SPAN></SPAN></FONT></FONT></FONT> </DIV> <DIV><FONT face="Trebuchet MS"><FONT color="#0000ff"><FONT size="2"><SPAN class="212433408-28092005"><SPAN class="212433408-28092005">can i suite the var inputFields somehow?!</SPAN></SPAN></FONT></FONT></FONT></DIV></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Javascript mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</A></DIV> <BR class="Apple-interchange-newline"></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV></BODY></HTML>