[thelist] Form/SQL Logic

Palyne Gaenir palyne at sciencehorizon.com
Fri Jul 14 13:42:39 CDT 2000


You're a god.  (Little g, but big hugs. :-)) Thanks Rudy.  As soon as 
one of my just-released sites quits burning down on the backend :-(  
I'll test that out and get back to you. -- Palyne

On 13 Jul 2000, at 20:59, rudy limeback wrote:


hi palyne

i think i might have something you could use (or adapt)

i recently wrote a page very much like what you're describing

please see http://r937.com/sortdropdown.html

you can prepopulate the dropdown with a cfoutput, that's easy, right?

to submit the sorted results, my code isn't really all that clear (i was in
a hurry), so here's what it's doing --

the submit button is labelled "Save Results" because it's supposed to save
the sorted results back into the database

the onSubmit function is called showMenu and it loops through the sorted
results building up a string which it then displays in an alert -- i don't
think you're going to need to do anything (maybe you won't even need an
onSubmit function) because the sorted results are actually in the form
fields, so they'll get submitted that way to your cf action page

i'm not sure whether those form fields are going to need unique names for
your cf action page to access them -- can you loop through them in cf as a
structure?  i'd probably give them names and send over a hidden field
containing the number of fields

if anything i'm saying is not clear, please let me know

also, there is the issue of writing back to the database the new rank
numbers of multiple items -- obviously this will have performance
implications, so after you have successfully tested the "brute force"
method, where you just update all the rows, you might consider checking
whether the new rank number is different from the old one

for example, if you shift "four" down past "six" then the new ranks
returned to your action page are

  1 one
  2 two
  3 three
  4 five  <== changed
  5 six   <== changed
  6 four   <== changed
  7 seven
  8 eight
  9 nine
  10 ten

and the only ones you really need to update are five, six, and four

help yourself to my javascript if you wish

rudy.limeback
r937.com
evolt.org


> I want to make a multi-line sort of box (via cfml) in my html
> form, that CFLOOPS/CFOUTPUTS a list of column values into it,
> and this box, instead of selecting, allows the user to "order"
> the items.  I want people to be able to "arrange" the items in
> it -- JUST like you would toolbar options in most programs, for
> example, where you can click on an item and then click an "up"
> or "down" button to arrange them.






More information about the thelist mailing list