Hi Kay,

Just a quick suggestion...you can get that piece of code working quite easily by using square bracket key notation in your structure in oppose to dot notation.....ie:

<cfparam name="currentstep" default="step2">
<cfloop list="#StructKeyList(validation.registration[#currentstep#])#" index="field">


This should work fine, though you may need single quotes around that #currentStep# variable....ie ['#currentStep#']....try both.

Phil




Geoff Bowers wrote:

Are you building a multi-step form? Might be a better way to do it. We use the concept of a PLP in FarCry CMS to build wizards or multi-step forms -- but the code we use is something that could be used in any CF app.


Mike Nimer's original code is here (saves you separating the stuff from FarCry):
http://sourceforge.net/projects/cmstoolkit/


And there is an advanced tutorial here:
Conditional PLPs
http://farcry.daemon.com.au/go/documentation/developers/tech-notes

If you have to build a multistep form this code makes it a dream. But then again I may have read your message all wrong ;)

-- geoff
http://www.daemon.com.au/

Kay Smoljak wrote:

Hey everyone,

Here’s an interesting pickle... I'm trying to loop over a complex
structure containing structures of arrays of structures. Trick is, one of
the structure names is dynamic.

I can do this:
<cfloop list="#StructKeyList(validation.registration.step1)#" index="field">


But "step1" (which is a structure, containing a couple of simple values
and an array of structures) might actually be "step2". I tried this:

<cfparam name="currentstep" default="2">
<cfset structkey = "validation.registration.step#currentstep#">
<cfloop list="#StructKeyList(evaluate(structkey))#" index="field">

Which gives me the error "Complex object types cannot be converted to
simple values."

Any ideas? I'm spewing because I thought I had it all worked out
syntactically (it parses, then stops when a variable is not defined) but
when I feed real data through it barfs. My brain hurts :(

Thanks,
Kay.






---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to