DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ColdFusion (http://www.daniweb.com/forums/forum19.html)
-   -   Problem with <cfselect (http://www.daniweb.com/forums/thread161507.html)

swskpper Dec 9th, 2008 3:45 pm
Problem with <cfselect
 
I am a newbie and hope that someone can help. I have a <cfform that adds and updates records. I have 3 <cfselect statements that are dynamic. I user the selected attribute to display the current value if this is an update. The first one works fine.

The 2nd and 3rd will not show the current value when updating. They both show the initial value. The values are saved in the table correctly. The values are not related. Here is a sample of 2 of the selects.

<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.

arrgh Dec 10th, 2008 5:57 pm
Re: Problem with <cfselect
 
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.

swskpper Dec 11th, 2008 11:40 am
Re: Problem with <cfselect
 
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.

jedimatt Jan 9th, 2009 4:52 pm
Re: Problem with <cfselect
 
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/...elated-Selects

This is new functionalty in CF8.

rgds

JM


All times are GMT -4. The time now is 2:53 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC