943,653 Members | Top Members by Rank

Ad:
  • ColdFusion Discussion Thread
  • Unsolved
  • Views: 4139
  • ColdFusion RSS
Dec 9th, 2008
0

Problem with <cfselect

Expand Post »
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.

ColdFusion Syntax (Toggle Plain Text)
  1. <td>
  2. <cfselect enabled="No"
  3. name="dept_code"
  4. size="1"
  5. id="dept_code"
  6. required="yes"
  7. message="Please select a Valid Department Code"
  8. multiple="no"
  9. query="list_active_depts"
  10. value="dept_code"
  11. display="dept_code_desc"
  12. selected="#user_dept_code#" onChange="#user_dept_code#"
  13. queryPosition="Below">
  14. </cfselect>
  15. </td>
  16. <tr>
  17. <td>
  18. <cfselect name="Fstp_code"
  19. size="1" id="Fstp_code"
  20. required="yes"
  21. message="Please select a Valid FSTP Code"
  22. multiple="no"
  23. query="list_active_fstp"
  24. value="fstp_code"
  25. display="fstp_code_desc"
  26. queryPosition="below"
  27. selected="#user_fstp_code#" onChange="#User_fstp_code#">
  28. </cfselect>

Any help would be greatly appreciated.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
swskpper is offline Offline
3 posts
since Dec 2008
Dec 10th, 2008
0

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.
Reputation Points: 32
Solved Threads: 44
Posting Whiz
arrgh is offline Offline
348 posts
since Dec 2008
Dec 11th, 2008
0

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
swskpper is offline Offline
3 posts
since Dec 2008
Jan 9th, 2009
0

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
jedimatt is offline Offline
20 posts
since Jan 2009
Jun 14th, 2011
0
Re: Problem with <cfselect
the selected attribute does not work unless it is used in conjunction with the 'query' attribute. In other words, this won't work:
<cfselect name="CTitle" selected="#rec.CTitle#">
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
</cfselect>

-BUT...this WILL work-
<cfselect name="CTitle" query="recCT" display="ctitle" value="ctitle" queryPosition="below" selected="#rec.CTitle#">
<option value=""></option>
</cfselect>

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bregan507 is offline Offline
1 posts
since Jun 2011

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ColdFusion Forum Timeline: Multiple flash CFFORMs in loop
Next Thread in ColdFusion Forum Timeline: ColdFusion 8/Posting to AMAZON S3





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC