954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with <cfselect

I am a newbie and hope that someone can help. I have a <td>
<cfselect enabled="No"
name="dept_code"
size="1"
id="dept_code"
required="yes"
message="Please select a Valid Department Code"
multiple="no"
query="list_active_depts"
value="dept_code"
display="dept_code_desc"
selected="#user_dept_code#" onChange="#user_dept_code#"
queryPosition="Below">
</cfselect>
</td>
<tr>
<td>
<cfselect name="Fstp_code"
size="1" id="Fstp_code"
required="yes"
message="Please select a Valid FSTP Code"
multiple="no"
query="list_active_fstp"
value="fstp_code"
display="fstp_code_desc"
queryPosition="below"
selected="#user_fstp_code#" onChange="#User_fstp_code#">
</cfselect>


Any help would be greatly appreciated.

swskpper
Newbie Poster
3 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
 

Did you verify the "selected" values actually exist in the query?

Other than that the code looks okay except for the onChange. OnChange accepts javascript/actionscript. But it looks like you are passing in the selected value instead, which probably wouldn't work.

arrgh
Posting Whiz
381 posts since Dec 2008
Reputation Points: 32
Solved Threads: 47
 

I took out the "onchange" and the 2nd cfselect began working. I believe that the values for the 3rd select are populated. I am trying to make sure of that now.

swskpper
Newbie Poster
3 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
 

Hi,

You may be better off using the bind attribute to link multiple selects together.

Have a look at Ben Fortas example using linked selects
url: http://www.forta.com/blog/index.cfm/2007/5/31/ColdFusion-Ajax-Tutorial-2-Related-Selects

This is new functionalty in CF8.

rgds

JM

jedimatt
Newbie Poster
20 posts since Jan 2009
Reputation Points: 10
Solved Threads: 1
 

the selected attribute does not work unless it is used in conjunction with the 'query' attribute. In other words, this won't work:
Mr.Mrs.

-BUT...this WILL work-

ALSO - I've found that when making changes to your code, then hitting the 'refresh' button doesn't always actually 'refresh' the page. Be sure to hit the 'CTRL' + 'F5' key to do a 'hard refresh'.

bregan507

bregan507
Newbie Poster
1 post since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You