Solved

weird behavior on CF

Posted on 2002-07-17
6
141 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 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Domain Name E-mail Address & Outlook Integration 3 47
Problem to Eclipse 16 154
PHP Register global 21 119
SSL Cert Issues When Testing Microsoft Remote Connection Analyzer 3 73
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…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

710 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