Solved

weird behavior on CF

Posted on 2002-07-17
6
140 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IIS 8.5 2 52
Web Site Hosting 10 94
WAMP server installation, getting error popups, DLLs missing 5 84
htaccess block all countries but the US 4 34
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…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

713 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