Solved

weird behavior on CF

Posted on 2002-07-17
6
137 Views
Last Modified: 2013-12-24
I have the folowing code that uses a query to a data base table containing the action types. It produces a drop down selection and the default selection is equal to the value of the select_record.ActionType in a different query to another table in the same database. This works fine. Infact, it the syntex works great for many other drop down menus I have in this application except for one.

//
<cfselect name="ActionType" tabindex="2" size="1" message="Action Type - REQUIRED" query="select_ActionType" value="ActionType" selected='#select_record.ActionType#' required="Yes">
//

The code below refuses to populate the "selected" with the value from select_record.Status. It defaults every time to the first selection in the drop down menu.

//<cfselect name="Status" tabindex="8" size="1" query="Select_Status" value="Status" selected='#select_record.Status#'>
     </cfselect>
//

Any ideas as to why this is happening?? Is there maybe something in the queries or database that I should be looking at? I see no problem with the syntex as written.
0
Comment
Question by:apwbe
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
CFXPERT earned 200 total points
ID: 7160206
I dont normally use a cfselect for dropdowns I just would do it something like this:

<select name="status">
<cfoutput>
<option value="#select_record.Status#" selected>#select_record.Status#
</cfoutput>
<cfoutput query="Select_Status">
<cfif select_status.status NEQ select_record.Status>
<option value="#status#">#status#
</cfif>
</cfoutput>
</select>

Try replacing your <cfselect> with this code above.

KWK
0
 
LVL 3

Expert Comment

by:SewellM
ID: 7160223
I have also run into a problem with values having leading/trailing spaces which made them NEQ.  I would trim() both the values to make sure they are not space padded.

Michael
0
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7160246
that's a good idea  sewellm.  Especially if you're using sql datatype CHAR which always leaves blanks in the field.
0
Give your grad a cloud of their own!

With up to 8TB of storage, give your favorite graduate their own personal cloud to centralize all their photos, videos and music in one safe place. They can save, sync and share all their stuff, and automatic photo backup helps free up space on their smartphone and tablet.

 

Author Comment

by:apwbe
ID: 7160299
The code you submitted worked super and seemed to solve my problem. I am checking into the trim() function but my first attempt failed. I probably need to look more into how to use it as we do use SQL Server but for the time being I am off and running.

Thanks to both of you for your quick replys. You help make this service the best.

Warren
 
0
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7160348
Glad I could help ya out.
0
 
LVL 3

Expert Comment

by:SewellM
ID: 7160390
Me too ... #trim(varname)# FYI .. removes leading and trailing spaces.

Michael
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
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…
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

14 Experts available now in Live!

Get 1:1 Help Now