RE: checkbox arrays and validation

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

 



On 05 October 2004 13:55, Angelo Zanetti wrote:

> Hi Marek,
> 
> I try to access the array like this:
> 
>  document.frmft.elements["chkmodels[]"];
> 
> but doesnt work. I also tried this:
> 
> models = document.forms['frmft'].elements["chkmodels[]"];
> 
> is there not a problem with the elements part?

So long as your form goes something like:

  <form name="frmft" ....>
    <input type="checkbox" name="chkmodels[]" value="1">Value 1<br>
    <input type="checkbox" name="chkmodels[]" value="2">Value 2<br>
    <input type="checkbox" name="chkmodels[]" value="3">Value 3<br>
    ...
  </form>

you can refer to the checkboxes simply as

   document.frmft["chkmodels[]"]

This is the way I've always done it, and it's always worked a treat.

Of course, in this situation this will give you an array of checkbox objects which you then have to index into, but that's a whole other story.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux