I'm trying to dynamically create/assign variables whose names are in an array.  
I wish to create a variable with default information and if the form version of 
the variable is defined (it's a checkbox coming from a form on another page) 
then I'd like it to have different information.

<cfset the_field = 
listToArray("contact_correspondence,contact_email,contact_event_off_campus,")>
<cfloop index="ii" from="1" to="#arrayLen(the_field)#">
      <cfset var1= "#the_field[ii]#">
      <cfset "#var1#" = "false">
      <cfif isDefined('form.#the_field[ii]#')>
            <cfset "#var1#" = "true">
      </cfif>
      <cfoutput>#the_field[ii]#:#contact_event_off_campus#</cfoutput><br>
</cfloop>

Oddly to me, if the field exists - that it was a checked checkbox, the output 
works fine, otherwise it gives a "variable not defined" error on the output.  
It seems to me that the variable should be defined whether a form field existed 
or not since I set that before the IF.

thanks for any assistance.  I hope I described it ok.

daniel
- webtool -

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:242050
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

Reply via email to