[Zope] getting all fields from dynamic checkboxes

David H bluepaul at earthlink.net
Sun Apr 3 18:16:41 EDT 2005


Dan E wrote:

>Hi,
>Has anyone found a way to get a list of boolean values from
>dynamically created checkboxes.
>I have created a bunch of checkboxes within a repeat loop like this:
>
>             <input type="checkbox"
>                       class="noborder"
>                       name="cb_array:list:int"
>                       tal:attributes="tabindex tabindex/next;
>                       checked python:test(curr_prop, 'checked', None);">
>
>but when I access the cb_array from my python script, I only get the
>checked values (and I can no longer match the values up with the
>checkbox they came from).
>
>any help on this would be appreciated.
>thanks in advance,
>Dan
>
Dan,
Not really sure if this is what you want.  But i've done stuff like:

<form action="showRequest">
   <tal:block repeat="num python: range(10)">
   <input type="checkbox"
           class="noborder"
           tal:attributes="name python:'checkBox'+ str(num);">

  </tal:block>
    <input type="submit" value="test me!">    
  </form>
  </body>

When showRequest is called, it displays just the selected checkboxes like:

 checkBox0    'on'
checkBox2    'on'
checkBox4    'on'
checkBox7    'on'

hth,
David


More information about the Zope mailing list