I have a form with dynamically created radio buttons. They look like this in 
the source:

      <tr class="background-hilite">
        <td align="center" width="25">1</td>
        <td>You'd like a place to smoke on campus</td>
        <td width="200">
     <table align="center" width="100%"  border="0" cellspacing="0" 
cellpadding="2">
        <tr class="background-hilite">                  
        <td align="center" width="25%">SA<br />
          <input name="Q_question1" id="Q_question1" type="radio" value="1_1" />
        </td>                   
        <td align="center" width="25%">A<br />
          <input name="Q_question1" id="Q_question1" type="radio" value="1_2" />
        </td>           
        <td align="center" width="25%">N<br />
          <input name="Q_question1" id="Q_question1" type="radio" value="1_3" />
        </td>                   
        <td align="center" width="25%">D<br />
         <input name="Q_question1" id="Q_question1" type="radio" value="1_4" />
        </td>                   
        <td align="center" width="25%">SD<br />
         <input name="Q_question1" id="Q_question1" type="radio" value="1_5" />
        </td>              
        </tr>           
      </table>
    </td>
     </tr>

I'm looping over the fieldnames,inserting the values into the db, workin just 
fine. 

What's the best way to server side validate to make sure at least ONE radio 
button per set was selected? 

Here's my loop insert in case that helps ( don't pay attention to the no 
<cfqueryparam>s, just testing this out:


<!--- Loop over fieldnames adding to db --->
<cfloop list="#FORM.fieldnames#" index="thisField">
   <cfif ListFirst(thisField, "_") EQ "Q">
    <cfquery datasource="#SESSION.DSN#">
    INSERT INTO tblevalanswerresults (answerID, questionID, questionsetID)
    VALUES (#ListLast(FORM[thisField], "_")#, #ListFirst(FORM[thisField], 
"_")#,                              #FORM.questionset#)
    </cfquery>
   </cfif>
</cfloop>



Thanks,
Will

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272772
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to