[Zope] dynamic radio buttons

garry saddington garry at joydiv.fsnet.co.uk
Sat Oct 2 14:04:55 EDT 2004


Is there any way to use radio buttons generated dynamically as a result of a 
ZSQL method. Each iteration needs to have a different  name if they are to be 
treated as a separate group. The problem is compounded by the fact that I 
must write the user's choices to a database. Here is the code I have so far:

<form action=formhandlerinputresults>
<table border=1>
<tr><th>Name</th><th>Exam Grade</th><th>Term Grade</th></tr>
<dtml-in getclassmembers>
<input type=hidden name=result.studentid:records value=<dtml-var studentid>>
<input type=hidden name=result.classid:records value=<dtml-var teacherid>>
<tr><td><dtml-var firstname> <dtml-var surname></td>
<td><input type =radio name=result.mark:records  value="A">A&nbsp;
<input type =radio name=result.mark:records value="B">B&nbsp;
<input type =radio name=result.mark:records value="C">C&nbsp;
<input type =radio name=result.mark:records value="D">D&nbsp;
<input type =radio name=result.mark:records value="E">E&nbsp;
<input type =radio name=result.mark:records value="F">F&nbsp;
</td><td><input type =radio name=result.termmark:records  value="A">A&nbsp;
<input type =radio name=result.termmark:records value="B">B&nbsp;
<input type =radio name=result.termmark:records value="C">C&nbsp;
<input type =radio name=result.termmark:records value="D">D&nbsp;
<input type =radio name=result.termmark:records value="E">E&nbsp;
<input type =radio name=result.termmark:records value="F">F&nbsp;
</td></tr></dtml-in></table>
<br><br>

<input type=submit value="Enter Results">


I could use checkboxes but I want to prevent multiple selections
regards
garry


More information about the Zope mailing list