Noob Problem, Changing Checkbox[dyn_name][i] State



Hi all,

I'm using the following checkbox naming convention the reason being
that when I POST the form, PHP read it as a multidimonsional array
fairly easily.

<input type="checkbox" name="enabled[parent_name][]">

so when I post the form I will see (from PHP):

[enabled] => Array
(
[BaseMenu] => Array
(
[0] => 2
)

[Menu1] => Array
(
[0] => 40
[1] => 41
[2] => 42
)
[SubMenu1] => Array
(
[0] => 22
[1] => 21
)
etc...etc.....


This is an excellent way for POST'ing to PHP, the problem I have is at
the Client Side... when I deselect a 'master' checkbox (i.e. Menu1) I
want the sub menu's to deselect (i.e. Submenu1)

This doesnt happen, I've got my onClick working to the point that I
can display the various passed arguments.
So when I click on Menu1 it will count the number of checkboxes for
SubMenu1 and display an alert dialog whilst incrementing on each loop
but this only outputs a string.

So why does the following not work?
document.form.enabled[Submenu1][i].checked = false;

I cannot even use ...
alert(document.form.enabled[Submenu1][i].value)

Obviously it is the way I am accessing the checkboxes - can these be
mutli-dimensional?
checkboxname[group_name][0], checkboxname[group_name][1]

.



Relevant Pages

  • Re: Beginger Web Form Question
    ... What I want to do is create a document with checkboxes that all the ... So far it seems like I will have to install PHP and mySQL into the Mac ... There's a database called SQLite that's very easy to install and yet is ...
    (alt.html)
  • Re: [PHP] Foldable Checkbox lists
    ... Newbie to PHP here. ... I have a list of categories, as checkboxes, that I ... obviously don't want to display all of the categories at once to the ...
    (php.general)
  • Re: Query string before parsing
    ... software generator which creates multiple checkboxes using the same ... pass the correct POST values. ... Actually this may be a bug for PHP to fix. ... This is what w3 has to say about checkboxes: ...
    (comp.lang.php)
  • Re: Query string before parsing
    ... software generator which creates multiple checkboxes using the same ... If the package is supposed to produce markup that sends a request to ... PHP handles correctly formatted post data, ... suddenly would return an array without warning, ...
    (comp.lang.php)
  • Re: PHP + Checkbox values
    ... trying to send multiple values of checkbox element using POST method. ... I am always getting only one element in the array. ... (I an using PHP 5.2.5) ... If I select first two checkboxes, I get the following for ...
    (comp.lang.php)