Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: AW: AW: [Javascript] addin <input fields> via visibility orsimilar?


  • From: junado at junado.com (Julien Nadeau)
  • Subject: AW: AW: AW: [Javascript] addin <input fields> via visibility orsimilar?
  • Date: Mon Sep 26 15:32:11 2005

I suggest you do something like this:

replace:
     if (inputFields[i].getAttribute("name") == "products_id[] 
[products_quantity]") {

with:
     if (inputFields[i].getAttribute("name").substring(0,11) ==  
"products_id") {

This will scan for fields where the attribute "name" starts with  
"products_id".

Julien Nadeau
junado@xxxxxxxxxx

Le 05-09-26 ? 08:14, Michael Borchers a ?crit :

> >
>  function countRows() {
>     var orderNumRows = 0;
>     var inputFields = document.getElementsByTagName("input")
>     var numTag = inputFields.length;
>     for (i=0; i<numTag; i++) {
>         if (inputFields[i].getAttribute("name") == "test[]") {
>             orderNumRows++;
>         }
>     }
>
>     alert(orderNumRows);
> }
>
> <<<
>
> ok, now my input's name is products_id[X][products_quantity], while  
> X is the position in array.
> regarding your function mine should look like this, or?
>
> function countRows() {
>     var ordersNumRows = 0;
>     var inputFields = document.getElementsByTagName("input")
>     var numTag = inputFields.length;
>     for (i=0; i<numTag; i++) {
>         if (inputFields[i].getAttribute("name") == "products_id[] 
> [products_quantity]") {
>             ordersNumRows++;
>         }
>     }
>
>     alert(ordersNumRows);
> }
>
> or do i need to add the X within "products_id[" + i + "] 
> [products_quantity]"?
>
> and how can i make it work for selects? just change  
> document.getElementsByTagName("select")?
> thanks!
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.LaTech.edu/pipermail/javascript/attachments/20050926/db4d956f/attachment.html