Solved

Dynamic DropDown Update

Posted on 2003-12-08
2
163 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
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

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Script 12 135
how to setup ssl access to internal local machine 4 109
UPLOAD FILE TO Web API USING POST 5 106
Nameserver and MX Record 2 63
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

15 Experts available now in Live!

Get 1:1 Help Now