473,394 Members | 1,812 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,394 software developers and data experts.

CF not returning values to drop down list

139 100+
Hello,

I've written a script which returns the admin rights of users in a table - their access level, and their priviledges.

The priviledge are returned to a check box and the admin rights to a drop down list. I want this list to have more than one value so that it can be altered.

I've created a loop to run through the drop down options and select the one that matches in the database. However it doesn't appear to be working - its not returning the value in the ViewLevel field. It works on other scripts where I return a single row ID, but not when I return all the rows in the database.

Any ideas what I am doing wrong?

Here's the (stripped down) script:

Expand|Select|Wrap|Line Numbers
  1. <cfquery datasource="repairmdb" name="GetViewLevel">
  2.     select        ViewLevel, ViewText
  3.     from        tblViewLevel
  4.     order by    ViewLevel
  5.     </cfquery>
  6.  
  7.  
  8.     <cfquery name="GetUsers" datasource="repairmdb">
  9.      select distinct    LoginName, 
  10.             FirstName, 
  11.             Surname,
  12.             ViewLevelFK, 
  13.             CreateReports, 
  14.             CreateUncompReport,
  15.             DeleteRecords,
  16.             AdminRights
  17.     from        tblWebsiteUsers
  18.     order by    Surname
  19.  
  20.  
  21.     </cfquery>
  22.  
  23. <div>
  24.             <form action="Devaction_userchange.cfm" method="post">
  25.             <table style="width: 650px;">
  26.  
  27.             <tr>
  28.             <th class="thl" style="width: 150px">User Name</th>
  29.             <th class="thl" style="width: 100px">Access Level</th>
  30.             <th class="thc" style="width: 100px">Create Report</th>
  31.             <th class="thc" style="width: 140px">Create Uncomp. Jobs Report</th>
  32.             <th class="thc" style="width: 100px">Delete Records</th>
  33.             <th class="thc" style="width: 100px">Admin Rights</th>
  34.             </tr>
  35.  
  36.             <cfoutput query="GetUsers">
  37.  
  38.             <tr>
  39.             <td class="thl" style="width: 150px">#FirstName# #Surname#</td>
  40.             <td class="thl" style="width: 100px">
  41.  
  42.             <select name="ViewLevelFK" size="1" class="droplist">
  43.             <cfloop query = "GetViewLevel">
  44.             <option value="#ViewLevel#"<cfif GetUsers.ViewLevelFK EQ ViewLevel> selected</cfif>>#ViewText#
  45.             </cfloop>
  46.             </select>
  47.             </td>
  48.  
  49.  
  50.             <td class="thc" style="width: 100px"><input type="checkbox" name="CreateReports" value="1"<cfif val(CreateReports) NEQ             
  51.  
  52. 0>checked</cfif>></td>
  53.             <td class="thc" style="width: 140px"><input type="checkbox" name="CreateUncompReports" value="1"<cfif val(CreateUncompReport) NEQ     
  54.  
  55.         0>checked</cfif>></td>
  56.             <td class="thc" style="width: 100px"><input type="checkbox" name="DeleteRecs" <cfif val(DeleteRecords) NEQ             
  57.  
  58. 0>checked</cfif>></td>
  59.             <td class="thc" style="width: 100px"><input type="checkbox" name="AdminRights" <cfif val(AdminRights) NEQ             
  60.  
  61. 0>checked</cfif>></td>
  62.  
  63.             <td><input type="submit" value="Update" class="buttons" name="updateUsers" /></td>
  64.             </tr>
  65.  
  66.             </cfoutput>
  67.  
  68.  
  69.  
  70.  
  71.             </form>
  72.  
thanks
Neil
Jul 29 '09 #1
2 3435
acoder
16,027 Expert Mod 8TB
Use a join query instead of two separate queries.
Sep 4 '09 #2
ndeeley
139 100+
Hi acoder,

Thanks - I`ll give it a go!
Sep 7 '09 #3

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

Similar topics

5
by: Rob Wire | last post by:
For the code below, how could I add an item in the drop down lists for both company and location to be an "All" selection that would send to the stored proc. spRptAttachments a value of "%" so...
2
by: R-D-C | last post by:
Hi, got a drop-down list on a windows form in VS.NET2003. In the form load when NOT a postback, we add four values to the drop-down list. These appear in Internet Explorer. When you click...
2
by: macyp | last post by:
I have to pass values from one aspx page to another. The controls I have in the first page are: a textbox, 3 drop down lists, and 2 check boxes, and a submit button. It is a search page, and the...
2
by: Nathan Sokalski | last post by:
I have a DropDownList that is returning the value from index 0 regardless of which item is selected. The code that I am using to test which index it is returning is: Label1.Text =...
9
by: Karl O. Pinc | last post by:
I want to return multiple values, but not a set, only a single row, from a plpgsql function and I can't seem to get it to work. (I suppose I'd be happy to return a set, but I can't seem to make...
0
by: kajir | last post by:
Hi, I am new at using ASP.Net 2.0. I have various drop down lists on my master page. They refer to an SQL database. I also have a menu on the master page. I can select the values in the drop...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
4
by: gotonagle | last post by:
hi , i m new to asp and leraning it... i have only one page in which i take some values like name, dob and education degree. after post back i return to this page iteslf.. but the values in...
3
by: jcassan | last post by:
Hello folks. I am new to these forums and have something, which has been stumping me for little while. I am using pspell to spellcheck a scrolling textbox (textarea) containing user input. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.