Re: Multiselect List. .

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

 



Ryan Jameson (USA) wrote:
That's not the problem. The problem is referring to the listbox via
javascript. It doesn't like the format: formName.listBoxName[].value it
has no problem with formName.listBoxName.value but then PHP doesn't seem
to handle it correctly.

There is a function called "MM_findObj" which does exactly what you need. I believe it originated from the Macromedia company (hence the MM prefix) - possibly used by Dreamweaver for its scripting purposes, but I digress.


Below is the funtion, and whenever you want to refer to oddly named form elements, you call MM_findObj('oddlyNamedFormElement[]') (and it returns an object reference to the form element that you can use normally).


function MM_findObj(n, d) { //v4.01 var p, i, x; if (!d) { d = document; } if ((p = n.indexOf('?')) > 0 && parent.frames.length) { d = parent.frames[n.substring(p+1)].document; n = n.substring(0,p); } if (!(x = d[n]) && d.all) { x = d.all[n]; } for (i = 0; !x && i < d.forms.length; i++) { x = d.forms[i][n]; } for (i = 0; !x && d.layers && i < d.layers.length; i++) { x = MM_findObj(n, d.layers[i].document); } if(!x && d.getElementById) { x=d.getElementById(n); } return x; }

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux