I dont think you are understanding what I'm trying to do.. I already check for server validation on the processing page. What I'm trying to prevent is from the user to hit submit without checking a box using client validation... javascript. If they hit submit I want to display a message that they havent selected anything... before it goes to the processing page.
On Tue, 16 Nov 2004 15:57:14 -0500, Ewok <[EMAIL PROTECTED]> wrote: > Well since checkboxes don't really exist in the scope unless they were > checked... I usually build cfparams for the fields with the same query and > loop I built the form fields with. Then use the query loop again to check > the value of the fields > > Basic example.... > > <~--- to build the fields (which you already have ) ---> > <cfloop from="1" to="10" index="i"> > <input type="checkbox" value="#i#" name="fld_#i#"><br> > </cfloop> > > <!--- then on the action page use the exat same loop that you built the > fields with to make params for the fields (im sure urs is a query loop) > So you don't get an error when you try to referecnce a field that wasn't > checked ---> > <cfloop from="1" to="10" index="i"> > <cfparam name="form.fld_#i#" default=""> > </cfloop> > > <!--- then loop once more to check the values of the fields ---> > <cfloop from="1" to="10" index="i"> > FORM.FLD_#i# = #form['fld_' & i]#<br> > </cfloop> > > You would just use currentrow or a recordID in your query loop rather than > an index. > > > > > -----Original Message----- > From: Greg Morphis [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 16, 2004 2:34 PM > To: CF-Talk > Subject: loop over form objects > > I have a page with X number of check boxes on it. > I have a query which generates these check boxes. > The query also returns the min and max value of the ID for those check > boxes. > Basically creating > r_23 > r_24 > r_25 > r_26 > ... and so forth. > I'm trying to loop over these fields to check to see if none are checked. > for(i=<cfoutput>#sweeps.minval#</cfoutput>;i < > <cfoutput>#sweeps.maxval#</cfoutput>; i++) > { > > } > > In the above scenerio the for loop would translate to > for(i=23;i<=26;i++) > > How do I check to see if r_i is checked.. > > -- > Auxilium meum a Domino > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184564 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54