House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Radio buttons in a loop

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

Radio buttons in a loop

Yep...this does happen...try setting CurrentQID outside the inner loop and use Bryan Stevenson 04/27/2004 01:40 PM
what query is returning the questions? Tony Weeg 04/27/2004 01:37 PM
I understand that the name needs to be unique for each row. jjakim 04/27/2004 01:34 PM
I would append the primary key to the form filed name, rather than the Josh 04/27/2004 12:49 PM
As others have suggested you could add to the name of the radio buttons. Doug James 04/27/2004 12:41 PM
----- Excess quoted text cut - see Original Post for more ----- Philip Arnold 04/27/2004 12:36 PM
Well if you name ALL the radio buttons for each question "Answer" as you have Bryan Stevenson 04/27/2004 12:25 PM
you could also append the queryName.currentRow value to the end of the Tony Weeg 04/27/2004 12:25 PM
is this a case for checkboxes instead? Tony Weeg 04/27/2004 12:22 PM
Well I am making a survey. All the questions come out of the database. Also Janine Jakim 04/27/2004 12:20 PM

04/27/2004 01:40 PM
Author: Bryan Stevenson Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161478 Yep...this does happen...try setting CurrentQID outside the inner loop and use it as you QID var inside the inner loop...that'll set ya right ;-) Bryan Stevenson B.Comm. VP & Director of E-Commerce Development Electric Edge Systems Group Inc. t. 250.920.8830 e. bryan@electricedgesystems.com --------------------------------------------------------- Macromedia Associate Partner www.macromedia.com --------------------------------------------------------- Vancouver Island ColdFusion Users Group Founder & Director www.cfug-vancouverisland.com   I understand that the name needs to be unique for each row.   I thought by adding the QuestionID to the end of the name would do the trick.   But there's something strange about the inner loop (the one that pulls the reference table answers)- it defaults to QuestionID being 1 for all the question.   When I test the questionID is correct outside that loop, but reverts to 1 inside that inner loop.   Strange.
04/27/2004 01:37 PM
Author: Tony Weeg Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161476 what query is returning the questions? are you using that queryName.currentRow for the questions unique id's? tony [mailto:jjakim@albemarle.org] Sent: Tuesday, April 27, 2004 1:33 PM To: CF-Talk Subject: Re: Radio buttons in a loop I understand that the name needs to be unique for each row. I thought by adding the QuestionID to the end of the name would do the trick.  But there's something strange about the inner loop (the one that pulls the reference table answers)- it defaults to QuestionID being 1 for all the question. When I test the questionID is correct outside that loop, but reverts to 1 inside that inner loop. Strange.
04/27/2004 01:34 PM
Author: jjakim Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161472 I understand that the name needs to be unique for each row. I thought by adding the QuestionID to the end of the name would do the trick.   But there's something strange about the inner loop (the one that pulls the reference table answers)- it defaults to QuestionID being 1 for all the question. When I test the questionID is correct outside that loop, but reverts to 1 inside that inner loop. Strange.
04/27/2004 12:49 PM
Author: Josh Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161458 I would append the primary key to the form filed name, rather than the current row. then you know exactly which record it is.  CUrrent row is only unique to that query struct, not the record in the database. -Josh -- Expert Hosting for Less! http://exciteworks.com ----- Excess quoted text cut - see Original Post for more -----
04/27/2004 12:41 PM
Author: Doug James Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161454 As others have suggested you could add to the name of the radio buttons. If you prepend the number to the name then you can employ the Val() function which: 'Returns a number that the beginning of a string can be converted to. Returns 0 if conversion is not possible.' Doug Janine Jakim wrote: ----- Excess quoted text cut - see Original Post for more -----
04/27/2004 12:36 PM
Author: Philip Arnold Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161449 ----- Excess quoted text cut - see Original Post for more ----- That is part of standard Radio Button functionality Name your buttons "Answer_#i#" where "i" is the question number, that way they'll be separate
04/27/2004 12:25 PM
Author: Bryan Stevenson Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161445 Well if you name ALL the radio buttons for each question "Answer" as you have done, you'll have the problem you are having.  Try adding the Question ID to the radio button name (i.e. Answer_Q1, Answer_Q2 etc.) and see where that gets ya ;-) Cheers Bryan Stevenson B.Comm. VP & Director of E-Commerce Development Electric Edge Systems Group Inc. t. 250.920.8830 e. bryan@electricedgesystems.com --------------------------------------------------------- Macromedia Associate Partner www.macromedia.com --------------------------------------------------------- Vancouver Island ColdFusion Users Group Founder & Director www.cfug-vancouverisland.com   Well I am making a survey. All the questions come out of the database. Also   have a 2nd table that is an "answer reference table (1=strongly   agree/2=agree/etc)and need to be radio buttons.   I have it so it looks pretty but doesn't quite have the functionality I   need.   What I need:   Each question to be able to have a radio button answer.   Problem: Only allows one radio button for all the questions combined. So I   answer #1. When I answer #2 there no longer is an answer for #1?   Make sense?   Here's the code.   Thanks in advance for any ideas.   j   <CFLOOP QUERY= "SurveyQuestion">   <TR>              <TD > #SurveyQuestion.Question#</TD>          <CFLOOP QUERY="AnswerRef">   <TD>     <INPUT TYPE="radio" NAME="Answer"   VALUE="#AnswerRef.AnswerID#">   </TD></CFLOOP>          </TR>   </CFLOOP>
04/27/2004 12:25 PM
Author: Tony Weeg Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161446 you could also append the queryName.currentRow value to the end of the Name="Answer" so that you can have unique names of radio buttons...like this... <CFLOOP QUERY= "SurveyQuestion"> <TR>                    <TD >  #SurveyQuestion.Question#</TD>             <CFLOOP QUERY="AnswerRef">         <TD>           <INPUT TYPE="radio" NAME="Answer#SurveyQuestion.currentRow#" VALUE="#AnswerRef.AnswerID#">         </TD></CFLOOP>                    </TR> </CFLOOP> is this a case for checkboxes instead? checkboxes allow for multiple checks, where radio buttons do not. tony Well I am making a survey. All the questions come out of the database. Also have a 2nd table that is an "answer reference table (1=strongly agree/2=agree/etc)and need to be radio buttons. I have it so it looks pretty but doesn't quite have the functionality I need. What I need: Each question to be able to have a radio button answer. Problem: Only allows one radio button for all the questions combined. So I answer #1. When I answer #2 there no longer is an answer for #1? Make sense? Here's the code. Thanks in advance for any ideas. j <CFLOOP QUERY= "SurveyQuestion"> <TR>                    <TD >  #SurveyQuestion.Question#</TD>             <CFLOOP QUERY="AnswerRef">         <TD>           <INPUT TYPE="radio" NAME="Answer" VALUE="#AnswerRef.AnswerID#">         </TD></CFLOOP>                    </TR> </CFLOOP>
04/27/2004 12:22 PM
Author: Tony Weeg Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161443 is this a case for checkboxes instead? checkboxes allow for multiple checks, where radio buttons do not. tony Well I am making a survey. All the questions come out of the database. Also have a 2nd table that is an "answer reference table (1=strongly agree/2=agree/etc)and need to be radio buttons. I have it so it looks pretty but doesn't quite have the functionality I need. What I need: Each question to be able to have a radio button answer. Problem: Only allows one radio button for all the questions combined. So I answer #1. When I answer #2 there no longer is an answer for #1? Make sense? Here's the code. Thanks in advance for any ideas. j <CFLOOP QUERY= "SurveyQuestion"> <TR>                    <TD >  #SurveyQuestion.Question#</TD>             <CFLOOP QUERY="AnswerRef">         <TD>           <INPUT TYPE="radio" NAME="Answer" VALUE="#AnswerRef.AnswerID#">         </TD></CFLOOP>                    </TR> </CFLOOP>
04/27/2004 12:20 PM
Author: Janine Jakim Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32175#161441 Well I am making a survey. All the questions come out of the database. Also have a 2nd table that is an "answer reference table (1=strongly agree/2=agree/etc)and need to be radio buttons. I have it so it looks pretty but doesn't quite have the functionality I need. What I need: Each question to be able to have a radio button answer. Problem: Only allows one radio button for all the questions combined. So I answer #1. When I answer #2 there no longer is an answer for #1? Make sense? Here's the code. Thanks in advance for any ideas. j <CFLOOP QUERY= "SurveyQuestion"> <TR>                    <TD >  #SurveyQuestion.Question#</TD>             <CFLOOP QUERY="AnswerRef">         <TD>           <INPUT TYPE="radio" NAME="Answer" VALUE="#AnswerRef.AnswerID#">         </TD></CFLOOP>                    </TR> </CFLOOP>
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference