Solved

Dynamic DropDown Update

Posted on 2003-12-08
2
162 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
2 Comments
 
LVL 15

Accepted Solution

by:
danrosenthal earned 500 total points
Comment Utility
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
Comment Utility
Ahhh!  Very Good,  thank you for the idea, I will take it from here.  
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now