PDA

View Full Version : dynamic check boxes + names


scroots
10-24-2002, 06:27 PM
how can i genreate checkboxes so that each one has the same name as a record in a table using response.write? i have all the dataaccess stuff written i just need to know how to do this. i have tried many ways and have failed.

thanks in advance

scroots

Roy Sinclair
10-24-2002, 07:07 PM
Inside your loop through your recordset:

<input type="checkbox" name="<%=recordSet("nameField")%>" />

scroots
10-24-2002, 07:36 PM
thanks roy your code helped, i adapted it a little to fit it into a response.write statement, so for thouse who read this thread the response.write way is:

Response.Write ("<input type=""checkbox"" name=""<%=recordSet(""ID_NO"")%/>")


scroots

whammy
10-25-2002, 12:28 AM
Actually this would be more correct - the above code doesn't throw an error?:

Response.Write ("<input type=""checkbox"" name=""" & recordSet("ID_NO") & """ />")


All you really need to remember is to comment any double quotes in your HTML (that's being served by ASP) with another one.

:D