473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

sort drop down up and down and save it into the dataabse

I have the drop down of requirements which are based upon program ID (another drop down). Also I have 2 buttons Up and Down. Once I click on the button Up I get the reuirement move 1 step up and so on, now I need to update the database to update the sorder order of the reuirements based on the program selected
I wrote some CF code but it does not seems to be working
Expand|Select|Wrap|Line Numbers
  1. <cfset oldorderlist = ValueList(infoNote.reqid)>
  2. <!--get current position -->
  3.  
  4. <cfset getcurrentposition =ListFindNoCase(oldorderlist,url.reqid)>
  5. <!--remove the requirement from the list -->
  6. <cfset oldorderlist =ListDeleteAt(oldorderlist, getcurrentposition)>
  7. <!--the lenght of the lsit -->
  8. <cfset thelsitlen= ListLen(oldorderlist)>
  9. <cfoutput>#thelsitlen#</cfoutput>
  10.  
  11. <!--moving the position of the requirement-->
  12. <cfif url.move EQ "moveUp">
  13. <cfset newposition = getcurrentposition - 1>
  14. <cfif newposition LT 1>
  15. <cfset newposition = 1>
  16. </cfif>
  17. <cfelse>
  18. <cfset newposition = getcurrentposition + 1>
  19. <cfif newposition GT ListLen(oldorderlist)>
  20. <cfset newposition = thelistlen + 1>
  21. </cfif>
  22. </cfif>
  23.  
  24. <! add to list >
  25. <cfif newposition GT thelistlen>
  26. <cfset neworderlist = ListAppend(oldorderlist, url.bookid)>
  27. <cfelse>
  28. <cfset neworderlist = ListInsertAt(oldorderlist, newposition, url.reqid)>
  29. </cfif>
  30.  
  31. <!-- loop through the list and update the database-->
  32. <cfset counter = 1>
  33.  
  34. <cfloop index="i" list="#neworderlist#">
  35. <cfquery datasource="HotBanana_Manager">
  36. UPDATE trnAcademicProgramsAndRequirementsMapping
  37. SET sortorder = <cfqueryparam value="#counter#" cfsqltype="cf_sql_integer">
  38. WHERE degreeid = <cfqueryparam value="#i#" cfsqltype="CF_SQL_INTEGER">
  39. </cfquery>
  40.  
  41. <cfset counter = counter + 1>
  42.  
  43. </cfloop>
Oct 5 '07 #1
1 2700
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

Please use code tags when posting code:

[CODE=cfm]
ColdFusion code goes here...
[/code]

Can you show your client-side code (HTML)?
Oct 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic...
2
by: Phil Longworth | last post by:
Im very new to Access 97 and Im sure I should be able to do this but cant work out how. Im bulding a database for my stamp collection. I have two tables; one with details of all the individual...
3
by: rquinnan | last post by:
Good Evening all, I would greatly appreciate any assistance on this Access 2003 quandary I'm in. And I do apologize if this has been answered somewhere else, I didn't see one that addressed my...
1
by: msnews.microsoft.com | last post by:
I'd like to hear your thoughts on best methods for populating drop down list controls. I have states and countries drop down lists that don't change often, so naturally I "hard code" them in the...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
6
by: Rob Meade | last post by:
Hi all, Looking for a bit of help if possible. For about 2 weeks now I've been investigating the best way to populate related drop down menus, and have their values pre-populated again if the...
7
by: jrb22250 | last post by:
I have the Dual Drop down in same page, my problem is the second drop down I can not figure out how to right an ORDER BY EPN asc or desc in there <html> <head> <meta name="GENERATOR"...
2
by: Jake Barnes | last post by:
I've been asked to help out with the navigation bar on this page: http://www.thesecondroad.org/ The drop down menu (which is pure CSS, save for a fix for IE) appears behind the Flash module....
8
by: gurmet | last post by:
I have two tables; 1. Called "Courses" that contains two fields "Course ID" and "Course Name". 2. Called "Sessions" that contains a field called "Course ID". Then I have a form with a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.