|
| |
|
|
Wendy P
Posts: 17 From: Timmins, Ontario, Canada Status: offline
|
Dynamic Check Box Selection - 5/30/2001 14:22:00
Greetings All,I have a question for folks... I want to generate a list of the records from a text field in my database. There could be a huge number of records to list. (This part is straight forward) Next to each record I want to place a check box that will allow a user to select which record they want to make reference to....without using a link to do so. The field can be quite long, so I don't want to use a drop-down box to provide the selection option as it would be too wide. The list will be part of a form that will submit the selection back to a database. Any help would be appreciated.
|
|
|
|
Vince from Spain
Posts: 658 From: Madrid Spain Status: offline
|
RE: Dynamic Check Box Selection - 5/31/2001 20:09:00
Hi Wendy, hopefully this code will show you how to go about it. It started from the DRW, and then went on a Spooky Diet so that it could be modified. www.outfront.net/spooky/adv_drw_diet.htm I've then added code for the form, the submit buttons and the checkboxes. I've preceeded each checkbox name with the string "id", and then the id number.<HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft FrontPage 4.0"> <TITLE></TITLE> </HEAD> <BODY> <form method="post" action="t3.asp"> <table width="100%" border="1"> <thead> <tr> <td width="10%"><b>ID</b></td> <td width="90%"><b>name</b></td> </tr> </thead> <tbody><!--#include file="_fpclass/fpdblib.inc"--> <% fp_sQry="SELECT * FROM results" fp_sDefault="" fp_sNoRecords="<tr><td colspan=2 align=left width=""100%"">Ningún registro devuelto.</td></tr>" fp_sDataConn="Base_de_datos1" fp_iMaxRecords=256 fp_iCommandType=1 fp_iPageSize=0 fp_fTableFormat=True fp_fMenuFormat=False fp_sMenuChoice="" fp_sMenuValue="" fp_iDisplayCols=2 fp_fCustomQuery=False BOTID=0 fp_iRegion=BOTID %> <!--#include file="_fpclass/fpdbrgn1.inc"--> <tr> <td width="10%"><input type="checkbox" name="id<%=FP_FieldVal(fp_rs,"ID")%>"> </td> <td width="90%"><%=FP_FieldVal(fp_rs,"name")%> </td> </tr> <!--#include file="_fpclass/fpdbrgn2.inc"--> <tr> <td width="10%"> </td> <td width="90%"><input type="submit" value="Submit"> <input type="reset"> </td> </tr> </tbody> </table> </form> </BODY> </HTML> So then in the page (in this case) t3.asp, to find out which checkboxes are checked, you could use code like this . . . <% dim objItem for each objItem in Request.Form response.write objItem & " : " & Request.Form(objItem) & "<BR>" next %> All those starting with the string "id" are the id numbers. In this case I am just writing them to the html page, but you could use this type of code to build an SQL query for instance. I hope this was the kind of thing you were after  Vince ------------------ Internet Business Solutions S.L.(Spain)
|
|
|
|
Wendy P
Posts: 17 From: Timmins, Ontario, Canada Status: offline
|
RE: Dynamic Check Box Selection - 5/31/2001 20:01:00
Hi Vince,This is exactly what I was trying to do. I'm always amazed at how quickly you guys can come up with this stuff. Thanks again. Wendy
|
|
|
|
Wendy P
Posts: 17 From: Timmins, Ontario, Canada Status: offline
|
RE: Dynamic Check Box Selection - 5/31/2001 20:24:00
Hi Vince,Follow up question for you....and excuse the ignorance but would the code for this change much if I wanted to you option buttons instead - limiting the user to only one selection from the long list of records? Thanks again Wendy
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|