|
|
On Dec 4, 8:24 pm, "jim1234" <webforumsu...@xxxxxxxxxxxxxx> wrote:
> Hi all,
>
> I am trying to create a form element within a component function which is
> then
> called from a .cfm page which has the cfform tags. I keep getting a context
> validation error for the form element tag. Here is some sample code:
>
> <cfcomponent name="yourComponent">
> <cffunction name="createTag" returntype="string" access="public">
>
> <cfsavecontent variable="returnContent">
> <cfselect name="thisSelect">
> <option value="0">Value 1</option>
> </cfselect>
> </cfsaveconten>
>
> <cfreturn returnContent>
> </cffunction>
> </cfcomponent>
>
> And in the .cfm page:
>
> <cfform>
> <cfinvoke component="yourComponent" method="createTag"
> returnVariable="returnContent"/>
> <cfoutput>#returnContent#</cfoutput>
> </cfform>
>
> The error occurs in the function and it says the cfselect must be within a
> cfform. I tried the function without the save content and just set the
> output="yes" but the same error occurs.
>
> Any help appreciated in how to get around this. Just putting the code in the
> .cfm is not an option for this.
>
> Any help appreciated.
> Jim
It's content parsing error... CF attempts to predict how your code is
going to be used, when you put <cfselect> in cfc function there is NO
way CF can enforce this function to be used ONLY inside <cfform> tag,
so it attempts to prevent runtime errors by NOT generating the
content...
|
|