IFELSETHEN
Programmer
Hi to all ….
I have a select list that I populate from a record set. I allow multiple selects. The form is sent to a processing template. The items on the select form can be more then one words. Like: Green Cars. The problem is when I evaluate the FieldName(s) that are sent I only get Green not Green Cars. Here's the code.
************ SELECT CODE **************************
<select name=fieldFrom size=5 style="width:120;" multiple>
<cfif qdetail.RecordCount gt 0>
<cfoutput query="qdetail">
<!--- load list box with all. --->
<option value =#qDetail.pref_detail#>#qDetail.pref_detail#</option>
</cfoutput>
</cfif>
</select>
************* GET CODE **************************
<CFLOOP Index="FieldName" List="#Form.Fieldnames#" DELIMITERS=",">
<tr><td>#FieldName#</td> <td>#Evaluate(FieldName)# </td></tr>
<cfif #FieldName# eq 'FIELDFROM'>
<cfif loop_flag eq 0>
<cfset loop_flag = 1>
<cfset ary_from = ListToArray(Evaluate(FieldName))>
</cfif>
</cfif>
<cfif #trim(FieldName)# eq 'EDIT_TO'>
<cfset edit_to2 = #Evaluate(FieldName)#>
</cfif>
</CFLOOP>
As you can see I am using ListToArray to parse the selected items coming from the form.
Thanks for the help ..... John
*********************
John Nyhart
*********************
I have a select list that I populate from a record set. I allow multiple selects. The form is sent to a processing template. The items on the select form can be more then one words. Like: Green Cars. The problem is when I evaluate the FieldName(s) that are sent I only get Green not Green Cars. Here's the code.
************ SELECT CODE **************************
<select name=fieldFrom size=5 style="width:120;" multiple>
<cfif qdetail.RecordCount gt 0>
<cfoutput query="qdetail">
<!--- load list box with all. --->
<option value =#qDetail.pref_detail#>#qDetail.pref_detail#</option>
</cfoutput>
</cfif>
</select>
************* GET CODE **************************
<CFLOOP Index="FieldName" List="#Form.Fieldnames#" DELIMITERS=",">
<tr><td>#FieldName#</td> <td>#Evaluate(FieldName)# </td></tr>
<cfif #FieldName# eq 'FIELDFROM'>
<cfif loop_flag eq 0>
<cfset loop_flag = 1>
<cfset ary_from = ListToArray(Evaluate(FieldName))>
</cfif>
</cfif>
<cfif #trim(FieldName)# eq 'EDIT_TO'>
<cfset edit_to2 = #Evaluate(FieldName)#>
</cfif>
</CFLOOP>
As you can see I am using ListToArray to parse the selected items coming from the form.
Thanks for the help ..... John
*********************
John Nyhart
*********************