If I create a layout in CF9 using cflayout as below:
<cfajaximport tags="cfform">
<cflayout type="border" name="example">
<cflayoutarea position="center" name="_center" source="/example/center.cfm" />
</cflayout>
and then create a center.cfm file to be included:
<cfform name="myForm" id="myForm" action="post">
<cfinput name="field1" type="text"><br/>
</cfform>
<script>
ThisForm = document.getElementById('myForm');
alert(ThisForm.id);
</script>
I get an error:
Error processing JavaScript in markup for element cf_layoutarea_center
But if I move the contents of center.cfm into the tag (and remove the source parameter) the code works as expect. Can anyone tell me how I can get this to work using the center.cfm file? Or explain why this doesn’t work?
Thanks for your time.
Cheers
Mark
(Dan provided the answer already. But just to show it can work ..)
This worked fine for me under CF9. I am not sure why adding the tags did not work for you.
test.cfm
myForm.cfm