Solved

weird behavior on CF

Posted on 2002-07-17
6
135 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
Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

19 Experts available now in Live!

Get 1:1 Help Now