using cfuniform tags in a function

8 views
Skip to first unread message

Marc Esher

unread,
Jul 8, 2011, 4:02:45 PM7/8/11
to cfunifo...@googlegroups.com
All,

I've got a form, and I need to render a dynamic set of
hierarchyically structured questions. For example, a radio-button
question might have 2 "child" questions. And those children questions
might have their own children, and so on.

Think of it like an array of arrays.

The sensible way to do this is a recursive function, something like
"renderQuestions" which takes the array of questions, loops over them,
and if it's got children, calls renderQuestions() on those children,
on down the hierarchy.

The problem is, I can't seem to be able to use cfuniform tags in a
function, because the "context" is lost. If I have a uform:fieldset,
and then a bunch of uform:field tags, I get this error:

The parameter combination cf_form of function GetBaseTagData does not
specify a base tag that exposes any data. (Error)

Is there a way to use the cfuniform fieldset and field tags in a function?

Thanks.

Marc

Matt Quackenbush

unread,
Jul 8, 2011, 5:23:23 PM7/8/11
to cfunifo...@googlegroups.com
Hmm, I'm not sure about that one.  I have nested unrelated tags within the cfU tags, and I'm 99% sure that the new MG scaffolding nests the cfU tags within some other tags, but I don't think I've ever tried to run the tags from within an object method.

Is there perhaps a way you can do the entire form rendering inside the object?

openForm()
    fooFieldset()
         renderQuestions()
closeForm()

I have no idea if that would work - either for your use case or for getting around that error; just an idea off the top of my head.

I'll try and do some digging in the CF docs later to see if there is some sort of workaround, but the error message sounds like the use of <cfassociate>/getBaseTagData() plus CFCs isn't supported.



--
You received this message because you are subscribed to the Google Groups "cfUniForm-users" group.
To post to this group, send email to cfunifo...@googlegroups.com.
To unsubscribe from this group, send email to cfuniform-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cfuniform-users?hl=en.


Marc Esher

unread,
Jul 8, 2011, 7:20:37 PM7/8/11
to cfunifo...@googlegroups.com
Thanks matt.  to be clear, this isn't in an object method, just a function in the .cfm page

Sent from my miniature iPad

Matt Quackenbush

unread,
Jul 9, 2011, 11:59:37 AM7/9/11
to cfunifo...@googlegroups.com
Ahh, my bad.  If I now understand correctly, the function is on the same page (e.g. cfm file) as the <cfimport /> and the form building.  In that scenario, I am not quite understanding _why_ it would lose "context".

Is there any way you can alter your function so that it only calls the field tag, and leave fielset out of it?  That would eliminate the getBaseTagData() from the equation.  (Fieldset uses it to get some data from the form tag - I can't remember what, off the top of my head.  I'll try and take a look at that to see if maybe there's another way around that, too.)
Reply all
Reply to author
Forward
0 new messages