complex values cannot be converted to ....
Hi;
I have an odd problem I can't seem to figure out....I wrote a couple of neat little functions to create boolean selects, populate them with the values from a database and "select" the correct one inthe html form.
<cffunction name="booleanSelect" access="public" output="yes" returntype="string"
description="Creates a booleaen select dropdown" >
<cfargument name="formvar" required="yes" type="string" />
<cfargument name="ffalse" required="yes" type="string" />
<cfargument name="ttrue" required="yes" type="string" /><cfscript>
myvar=evaluate("form.#arguments.formvar#");
if(myvar eq 0){sel = 'selected="selected"';}else{sel = '';}
writeoutput('<option value="0" '&sel&' >'&arguments.ffalse&'</value>');
if(myvar eq 1){sel = 'selected="selected"';}else{sel = '';}
writeoutput('<option value="1" '&sel&' >'&arguments.ttrue&'</value>');
</cfscript></cffunction>
can be called via:
<select name="status" id="status">
<cfscript>booleanSelect('status','Disabled','Enabled');</cfscript>
</select>
and that all works [that's the fixed version]
What I don't understand is why this does not work, the following DOES work in an insert form but not an edit form. and in both cases the form field used to populate the formvar argument is populated and has a value...
<cffunction name="booleanSelect" access="public" output="yes" returntype="string"
description="Creates a booleaen select dropdown" >
<cfargument name="formvar" required="yes" type="string" />
<cfargument name="ffalse" required="yes" type="string" />
<cfargument name="ttrue" required="yes" type="string" />
<cfscript>
if(form[arguments.formvar] eq 0){sel = 'selected="selected"';}else{sel = '';}
writeoutput('<option value="0" '&sel&' >'&ffalse&'</value>');if(form[arguments.formvar] eq 1){sel = 'selected="selected"';}else{sel = '';}
writeoutput('<option value="1" '&sel&' >'&ttrue&'</value>');
</cfscript></cffunction>
basically, why do I have to evaluate the formvar argument in one case and not in the other? I think I might be missing something important here....
-sean
