?
Solved

Context issues using CFFORM with CFC procedure calls

Posted on 2005-05-04
4
Medium Priority
?
483 Views
Last Modified: 2013-12-24
I may be out of luck, but it's worth asking:

I need to build a form with several required elements, but I use procedure calls to build these elements.  For instance one procedure call should build several <cfinput> tags.  But since all of the tags need to be on the same form, I can't start the cfform in the procedure call, creating a context error.

For example:
<cfform name="exam" method="post">
<cfoutput query="qGetQ">
   <cfinvoke
     component="app.assessment.cfc.#qGetQ.handler#"
     method="getAssessmentView">
       <cfinvokeargument name="pID" value="#qGetQ.question_id#">
       <cfinvokeargument name="pNum" value="#qNum#">
   </cfinvoke>
</cfoutput>
</cfform>

The problem is the procedure cannot see that I've started the <cfform> tag.  Error message:
 Context validation error for tag cfinput.
 The tag must be nested inside a cfform tag.

Is it possible at all to let the procedure see that the tag has been made in the calling page.  I checked and there is no Caller scope in a CFC procedures, and none of the other scopes seem to have any data related to the <cfform> tag.

Thanks for any input and suggestions
0
Comment
Question by:TimDg
2 Comments
 
LVL 9

Accepted Solution

by:
Dain_Anderson earned 2000 total points
ID: 13968190
Hi Tim,

Your question is a good one, and one that I've asked in the past as well. Here's the skinny: any "dynamic" writing of ColdFusion tags is not allowed, such as with CFFORM elements and other items such as CFQUERYPARAMs (those are the ones I've tried in the past). The problem is that while ColdFusion does support delayed evaluation (using the DE() function), it can't evaluate this type of situation because it will try to evaluate EVERYTHING in your output, not just the CFINPUT elements (i.e., words, HTML, etc...).

But, all hope isn't lost. In my experience, using CFFORM really only gets you client-side validation routines,respectively, of which I've since replaced with my own JavaScript validation libraries. Dynamically creating forms is a very common task, and one that I use frequently, especially with "output" CFCs. I would try using a regular form, and build in a "handler" CFC for validation. If you would like a copy of my validation routines (they're public), I'll be happy to email them to you.

HTH,

-Dain
0
 
LVL 1

Author Comment

by:TimDg
ID: 13968910
That's about what I figured :)  We're not actually using CFFORM, but our own custom tag set that manages our form validation.  It's much more advanced than normal cfform, but again the tags are dependent.  We've been continuing to brainstorm and have come up with several work arounds, but none that would be as straight forward as I would like.  Something I suppose we'll continue working with.

Thank you for your comments.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Integration Management Part 2
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question