Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dynamic DropDown Update

Posted on 2003-12-08
2
Medium Priority
?
168 Views
Last Modified: 2013-12-24
I am trying to add a feature to my CMS that will allow me to order my articles.  The method I am currently trying to use does a cfloop to add the total number of articles for that issue.  So if there are 6 articles there will only be a dropdown box that goes from 1 through 6.  So obviouly i want to be able to give each article a number that will put these articles in that order.

Here is an image to show what my admin looks like
http://www.jhasim.net/order_update.jpg

Here is my current code for displaying this information.

                              <cfoutput query="getArticles">
                              <form name="formOrder" action="update_articleorder.cfm" method="post">
                              <tr onMouseOver="this.style.backgroundColor='EEEEEE';" onMouseOut="this.style.backgroundColor='FFFFFF';">
                                    <td class="adminBlack"><a onClick="previewArticle()" target="windowname" href="../../files/articlefiles/flash/#articleFlash#">#ArticleName#</a></td>
                                    <td class="adminBlack">#ZoneName#</td>
                                    <td class="adminBlack" align="center">#ArticlePages#</td>
                                    <td class="adminBlack" align="center">#ArticleCMECredit#</td>
                                    <td class="adminBlack" align="center"><cfif ArticleReview GT 0>Yes<cfelse>No</cfif></td>
                                    <td class="adminBlack" align="center" width="30"><a href="article_edit.cfm?ID=#ArticleID#" class="adminLink">Edit</a></td>
                                    <td class="adminBlack" align="center" width="50"><a href="article_delete.cfm?ID=#ArticleID#&IssueID=#URL.ID#" class="adminLink" onClick="if(confirm('Click OK to delete the Article: #ArticleName#')){return true}else{return false}">Del</a></td>
                                    <td class="adminBlack" align="center">
                                    <SELECT name="#order_ArticleID#" size="1"><CFLOOP INDEX="LoopCount" FROM="1" TO="#getArticles.recordcount#"><OPTION value="#LoopCount#">#LoopCount#</OPTION></CFLOOP></SELECT>       
                              </form>
                              </cfoutput>







So all i would like to know is how would I go about creating the update.cfm page that would know how to handle the dynamic form name for the select box.  If there is a better method, please show me.

Thank you,
Jeff
0
Comment
Question by:jeffmace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
danrosenthal earned 2000 total points
ID: 9900094
I probably would name the select something like article_1, article_2, etc. (name="article#order_ArticleID#"), also I would include a list of articles to update by adding this outside of your cfquery:

<input type="hidden" name="article_id_list" value="#valuelist(getArticles.order_ArticleID)#">


Then, after verifying that each number from 1 to article count is represented here, so no 2 articles are given the SAME order I would update like this:

<CFLOOP list="#form.article_id_list#" index="ArticleID">

  <!--- just guessing on the table format here --->
  <CFQUERY ....>
    UPDATE order_Article
    SET article_order = #evaluate("article_"&ArticleID)#
    WHERE order_ArticleID = #ArticleID#
  </CFQUERY>

</CFLOOP>


0
 

Author Comment

by:jeffmace
ID: 9901141
Ahhh!  Very Good,  thank you for the idea, I will take it from here.  
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question