CFLOOP in Edit Mode - Invalid CFML construct
Hi, I'm stuck on this and could use some help. I'm trying to populate a multiple selection form in edit mode and highlight (selected) items that are stored with the record. I'm storing the multiple selections in a single VarChar column using a comma delimiter. Thanks CF***ERRORMESSAGE Invalid CFML construct found on line 682 at column 196. The error occurred in D:\Inetpub\wwwroot\fuelcellmagazine.com\wwwroot\admin_fcm\Press_Releases\press.cfm: line 682 680 : select name=pre_cat_id size=3 multiple id=cat_id 681 : CFOUTPUT query=GetCategoriesOutput 682 : option value=#categorie_id# CFIF ISDEFINED (PRSubmit_EDIT) AND ISDEFINED (pre_existing)cfloop index = ListElement list = #Edit_Get_Selected_PressRel.pre_cat_id#CFIF #ListElement# = #GetCategoriesOutput.categorie_id#selected/CFIF/cfloop/CFIF#cat_name#/option 683 : /CFOUTPUT 684 : /select/td CF***ERRORMESSAGE ***ACTUAL*CF***CODE** cfquery name=Edit_Get_Selected_PressRel datasource=#datasource# cachedWithin = #CreateTimeSpan(0, 0, 5, 0)# SELECT * FROM press_rel WHERE press_re_id = 5 /cfquery cfquery name=GetCategoriesOutput datasource=#Datasource# SELECT * FROM fuelcellmagazine.categories /cfquery select name=pre_cat_id size=3 multiple id=cat_id CFOUTPUT query=GetCategoriesOutput option value=#categorie_id# CFIF ISDEFINED (PRSubmit_EDIT) AND ISDEFINED (pre_existing) cfloop index = ListElement list = #Edit_Get_Selected_PressRel.pre_cat_id# CFIF #ListElement# = #GetCategoriesOutput.categorie_id#selected/CFIF /cfloop /CFIF#cat_name#/option /CFOUTPUT /select ***ACTUAL*CF***CODE** ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234846 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFLOOP in Edit Mode - Invalid CFML construct
BAD: CFIF #ListElement# = #GetCategoriesOutput.categorie_id#selected/CFIF GOOD: CFIF #ListElement# IS #GetCategoriesOutput.categorie_id#selected/CFIF In if statement is CF you have to use IS, EQ, NEQ =] -- Alan Rother Macromedia Certified Advanced ColdFusion MX 7 Developer ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234854 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFLOOP in Edit Mode - Invalid CFML construct
Oh yeah, You don't need the pound signs either. CFIF ListElement IS GetCategoriesOutput.categorie_idselected/CFIF -- Alan Rother Macromedia Certified Advanced ColdFusion MX 7 Developer ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234855 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFLOOP in Edit Mode - Invalid CFML construct
BAD: CFIF #ListElement# = #GetCategoriesOutput.categorie_id#selected/CFIF GOOD: CFIF #ListElement# IS #GetCategoriesOutput.categorie_id#selected/CFIF BETTER: CFIF ListElement IS GetCategoriesOutput.categorie_idselected/CFIF :-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234880 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFLOOP in Edit Mode - Invalid CFML construct
Even better cfif ListElement IS GetCategoriesOutput.categorie_idselected=selected/cfif ;) On 3/9/06, Claude Schneegans [EMAIL PROTECTED] wrote: BAD: CFIF #ListElement# = #GetCategoriesOutput.categorie_id#selected/CFIF GOOD: CFIF #ListElement# IS #GetCategoriesOutput.categorie_id#selected/CFIF BETTER: CFIF ListElement IS GetCategoriesOutput.categorie_idselected/CFIF :-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234888 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFLOOP in Edit Mode - Invalid CFML construct
Even better cfif ListElement IS GetCategoriesOutput.categorie_idselected=selected/cfif Sorry, I don't see the point here? Is OPTION SELECTED=selected legal in HTML? Even if yes, what is the advantage? Anyway, the whole loop could be optimized: Instead of CFOUTPUT query=GetCategoriesOutput 682 : option value=#categorie_id# CFIF ISDEFINED (PRSubmit_EDIT) AND ISDEFINED (pre_existing)cfloop index = ListElement list = #Edit_Get_Selected_PressRel.pre_cat_id#CFIF #ListElement# = #GetCategoriesOutput.categorie_id#selected/CFIF/cfloop/CFIF#cat_name#/option 683 : /CFOUTPUT Try CFOUTPUT query=GetCategoriesOutput option value=#categorie_id#CFIF ISDEFINED (PRSubmit_EDIT) AND ISDEFINED (pre_existing) AND listFind(Edit_Get_Selected_PressRel.pre_cat_id, categorie_id) selected/CFIF#cat_name#/option/CFOUTPUT -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234896 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFLOOP in Edit Mode - Invalid CFML construct
It is valid XHTML(or maybe it was part of the HTML 4.0 spec), actually all upper case like that would not be if I remember correctly. It was more or less a joke on my part although it would be a good habbit for anyone to be in. Especially if they were ever to have to write code for things such as cell phones. You are not supposed to have attributes that do not equal anything just like you are supposed to always have closing tags such as /option and when no closing tag available you end it with a / such as br / On 3/9/06, Claude Schneegans [EMAIL PROTECTED] wrote: Even better cfif ListElement IS GetCategoriesOutput.categorie_idselected=selected/cfif Sorry, I don't see the point here? Is OPTION SELECTED=selected legal in HTML? Even if yes, what is the advantage? Anyway, the whole loop could be optimized: Instead of CFOUTPUT query=GetCategoriesOutput 682 : option value=#categorie_id# CFIF ISDEFINED (PRSubmit_EDIT) AND ISDEFINED (pre_existing)cfloop index = ListElement list = #Edit_Get_Selected_PressRel.pre_cat_id#CFIF #ListElement# = #GetCategoriesOutput.categorie_id#selected/CFIF/cfloop/CFIF#cat_name#/option 683 : /CFOUTPUT Try CFOUTPUT query=GetCategoriesOutput option value=#categorie_id#CFIF ISDEFINED (PRSubmit_EDIT) AND ISDEFINED (pre_existing) AND listFind(Edit_Get_Selected_PressRel.pre_cat_id, categorie_id) selected/CFIF#cat_name#/option/CFOUTPUT ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234899 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFLOOP in Edit Mode - Invalid CFML construct
It is valid XHTML Ah ok. Personnally, I'll use XHTML when I'll need to, for the time being, I prefer having all CFML and HTML tags and attributes in upper case, and all variables and the rest of the code in lower case, question of readibility, but of course it is personal. Closing unnecessary tags also creates trouble with custom tags executed twice, so I prefer not using it at all. One would say that you don't have to apply XHTML rules to CF tags, but that would be even more confusing. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234904 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFLOOP in Edit Mode - Invalid CFML construct
If you do a cfexit method=exittag in your custom tags then you could do the / method with them. Although maybe there are times that could not be done, can not honestly think of a time but I am sure there are some. We use a system here that uses a ton of custom tags and unfortunately it is just second nature for me to type / so I would find myself constantly backspacing through my code, finally just ended up adding the cfexit tag. I have had to do a few XHTML classes, so it has become a hard habbit for me to break when I type out tags, but I doubt many of the things I write would pass the XHTML verification tools. On 3/9/06, Claude Schneegans [EMAIL PROTECTED] wrote: It is valid XHTML Ah ok. Personnally, I'll use XHTML when I'll need to, for the time being, I prefer having all CFML and HTML tags and attributes in upper case, and all variables and the rest of the code in lower case, question of readibility, but of course it is personal. Closing unnecessary tags also creates trouble with custom tags executed twice, so I prefer not using it at all. One would say that you don't have to apply XHTML rules to CF tags, but that would be even more confusing. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234905 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFLOOP in Edit Mode - Invalid CFML construct
If you do a cfexit method=exittag in your custom tags then you could do the / method with them. Just what I mean: you have to do something. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234919 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54