I can think of a number of workarounds, i was just wondering if there was a built in function to accomplish the sorting....
changing the format may be a good solution though... allthough it would change the number 1 to 01... that number would not match up with the uniqueid in the database anymore... I guess i would just need to reformat it when comparing it to the database with something like numberformat(numb, "0") ??? the list wouldnt work since all the form fields are radio buttons and some will not exist if they werent selected, I can keep them all alive through dynamic cfparams on the action page which would keep all fields in the collection...but form.fieldnames would only hold fields that were selected before the form was submitted i COULD move the params to the top of the form i suppose but like i said...the list could potentially get very large so I'd rather stay away from too many list functions thanks for the response ! ----- Original Message ----- From: "Stephen Moretti" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Friday, March 07, 2003 8:42 AM Subject: Re: Sorting a form collection? > Ewok, > > > > > Also, I didn't want to put 0's in front of single digit numbers since they > > are unique ID's of rows in my database table. > > > Use number format when you append your numbers to the form field names > eg. name="Q#NumberFormat(i,"00")# > > This will make sure that your numbers are zero filled. > > > > > > > > So, is there a function to sort a collection like you can with lists using > > listsort() ? > > > You could do a listsort on form.fieldnames, then loop through that to > process your form fields. > eg. > > <cfscript> > sortedlist = listsort(form.fieldnames); > for (i=1;i=ListLen(sortedList);i=i+1) { > thisfield = ListGetAt(sortedList,i); > WriteOutput(form[thisfield]); > } > </cfscript> > > Hope this helps > > Regards > > Stephen > ============================= > CF-Europe http://www.cf-europe.org/ > Olymia Conference Centre, London > 29-30 May 2003 > Keynote by Ben Forta and Tim Buntel > Discount tickets before March 14th 2003 > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4