[Zope] Multiple selections from checkbox form - and others...
Andy Smith
andy@ictibroker.com
Tue, 20 Apr 1999 23:20:47 -0400
> Hi!
>
> Got some questions that I hope you people can help me out with.
>
> 1)
>
> I want to manage a messagebord, mainly to remove unwanted/old
> messages. The
> messages are stored in a MySQL db. I have a sql method that select wanted
> data. I use the method in a form in a #in tag to displays the
> selected data,
> within the #in tag I added a <INPUT TYPE="checkbox"
> NAME="checked" VALUE=1>.
> I also have a hidden field submitting the id fields reffering to each
> selected record within the above mentioned #in tag.
>
> All looks just fine - the data is listed and checkboxes appear as they
> should. But trouble is - submitting the forms data will give me a list of
> 1's (only the checked out is submitted), and a list of _all_ selected row
> ids. I need just the ids corresponding to the checked out records. If it's
> at all possible - please tell me how to.
Hmmm... not sure if this is what you want, but if it is, then the answer
might be (literally) right under your nose ;) Look at the HTML source for
the management screen for a Zope folder. The process to select folders etc
using checkboxes is similar to what you describe...
If you structure your checkboxes as follows....
<INPUT TYPE="CHECKBOX" NAME="notes:list" VALUE="doe">
<INPUT TYPE="CHECKBOX" NAME="notes:list" VALUE="rae">
<INPUT TYPE="CHECKBOX" NAME="notes:list" VALUE="me">
Then the target of your form will get a 'notes' (variable/attribute) which
you can loop over, process etc, Only the values where the checkbox has been
selected will be included in the list. In place of 'doe, rae' me, you could
enter the ids of the objects you want to delete, wame say as the Zope
management screen does.
Cheers,
A.