Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

weird behavior on CF

Posted on 2002-07-17
6
Medium Priority
?
143 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
CFXPERT earned 800 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

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…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

705 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