Click to See Complete Forum and Search --> : dynamic radio button help needed
mangeloni
03-30-2003, 01:29 AM
I have a form which includes the following dynamic radio buttons
Top 5 Girl's names:
(o) Name1
(o) Name2
(o) Name3
(o) Name4
(o) Name5
Top 5 Boy's names:
(o) Name1
(o) Name2
(o) Name3
(o) Name4
(o) Name5
What I want to do is create a record set which gathers information from a table and dynamically populates the above 10 names values. It would gather the data from the following fields in a table:
GuesserUN (value=login UserName SV)
SuggestName1 (all values)
SuggestName2 (all values)
SuggestName1Sex (=Girl)
SuggestName2Sex (=Girl)
SuggestName1Sex (=Boy)
SuggestName2Sex (=Boy)
THIS MUST combine all values for SuggestName1 and 2, then display only the 5 most entered for each sex, then displays this record set accordingly as shown above.
I am using DW4, ASP/Javascript - and could really use some creative help here.
Thanks!
~MVA
Ribeyed
03-30-2003, 11:14 AM
hi,
all you need to do is build your sql statement to select the records and fields that make up your radio button. Create a recordset and then do a while loop to loop through your record set. Within your loop write out a radio button to the screen using the data in the recordset. Here is an example:
<%
sql = "SELECT * FROM tblTableName"
set RS = databaseconnection.execute(sql)
while not RS.EOF
%>
<input type="radio" name="radioname" value="<%=RS("FeildName")%>">
<%
RS.MoveNext
Wend
%>
THIS MUST combine all values for SuggestName1 and 2, then display only the 5 most entered for each sex, then displays this record set accordingly as shown above.
I get the bit about the 5 most entered but not sure what you mean for the rest of it. Can you post some example data for these fields?
mangeloni
03-30-2003, 06:20 PM
OK - to back-track a bit...
I have a form which has the following input fields:
SuggestName1 [text field]
SuggestName1Sex [to indicate what type of name is entered above, menu with 2 choices: Girl | Boy ]
SuggestName2 [text field]
SuggestName2Sex [to indicate what type of name is entered above, menu with 2 choices: Girl | Boy ]
Each of the above are entered into a table (Participants) in their own respective fields, along with a hidden field of GuesserUN (UserName). There can be many records in this table with this UserName.
So a record can be:
ABC_UserName
John William (suggested name 1)
Boy (type of name, sex, for suggested name 1)
Rose Marie (suggested name 2)
Girl (type of name, sex, for suggested name 2)
Another record can be:
ABC_UserName
Marie Anne (suggested name 1)
Girl (type of name, sex, for suggested name 1)
Jack William (suggested name 2)
Boy (type of name, sex, for suggested name 2)
What I want to happen in a record set is to find:
1) All records with logged-in GuesserUN
2) Then, I know this is tricky, find the top 5 entered names flagged as Girl's names and the top 5 entered as Boy's names.
3) Then display these as either 2 sets of 5 radio buttons or 1 set of 10.
4) Display these radios in another form and input into another table (Statistics).
***Some approaches possible:
Maybe it would be easier to treat this as 2 record sets? One for Boys and one for Girls?
Should I restructure my Participants table to accomodate another field structure? How about trashing the menus...and just go with 4 individual text fields
SuggestName1_Girl
SuggestName2_Girl
SuggestName1_Boy
SuggestName2_Boy
But I would still have to combine the values in 1&2_Girl and find the top 5 as combined.
In this case, it is just a small part of the whole application - and the Statistics table is brand new and open to changes as well.
Your help is greatly appreciated!
-Maria
Ribeyed
04-03-2003, 02:20 AM
Hi,
i would suggest a better database table structure first off, beacuse you will not be able to do what you want to do under your present database structure.
I would suggest at least a 3 table structure like the following:
tblSuggest
SuggestID (autonumber)
SuggestName (all the suggestions will go in as a new record)
UserID
GenderID
tblUser
UserID (autonumber)
UserName (you will have the guest account as a record here)
Email (users email address)
tblGender
GenderID (autonumber)
Gender (this would have male and female only)
Ok i hop ethis gets you started with this problem, i am really busy at the moment and look to be busy for the next 2 weeks. I am currently helping out someone else on the forum and would like to tie that up before i move on to your problem. If you don't mind holding on i promise once i have tied up other problem you will be next in line for my help.
Here is the first SQL statements to get you started to solve your functions.
1 for all records with logged-in GuesserUN.
UserName = "GuesserUN"
sql = "SELECT tblUser.UserName, tblUser.UserID, tblSuggest.SuggestID, tblSuggest.GenderID, tblSuggest.SuggestName FROM tblUserName, tblSuggest "
sql = sql & "WHERE tblUser.UserID = tblSuggest.UserID AND tblUser.