Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with ranking record ourder

Status
Not open for further replies.

bdee1

Programmer
Feb 6, 2004
17
US
i have a database table with a list of items and their rank. i have a page where users can go and enter new items, delete items and change the order of the items by chaging the value of the rank field. changing the rank changes the order in which they are displayed on the page - kind of like the netflix queue.

i am having a hard time writing the code to do what i want. i know this is a fairly common task, is there somewhere that may have a code snippet i could use as a template?

i saw one other post about this but it was never really solved.

can anyone help?
 
Here are a few links to help you learn the javascript

There's the javascript to do it... Now.. The cf to make that mean something.

You will need to set your options like this..

Code:
<option[red] value="#ID#"[/red]>#Whatever_Variable_Here#</option>

Note the red text, that's to emphasize that you need the primary key as the value of the option tag.

In the action page:

Code:
<cfset runner=0>
<cfloop list="#form.reorderVals#" index="sv">
  I'm updating this value #sv# as ###runner# in the list.
  <cfset runner = runner + 1>  
  <cfquery...>
    update table
       set priority = #runner#
     where itemID = #sv#
  </cfquery>
</cfloop>

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
thanks for the reply - sorry for my delay in getting back to it.

while that is similar to what i want to do - its nto quite it. my form uses text fields instead of selects (and it needs to be that way for my project). it is quite literally just like the netflix queue.
 
Sorry, don't use netflix..

The javascript for this wouldn't be that hard, any code to share?

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top