Solved

Dynamic DropDown Update

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ColdFusion Rereplace 3 80
question about access to website 2 78
spamming  on Hosted svrs? 6 91
How do disable only TLSv1.0 in Oracle Sun One 7.1 Server 9 99
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
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 will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

825 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