tag:help-archives.hannonhill.com,2010-02-09:/discussions/velocity-formats/9387-difficulty-with-a-formCascade CMS: Discussion 2014-03-17T19:00:51Ztag:help-archives.hannonhill.com,2010-02-09:Comment/320411262014-03-11T19:45:26Z2014-03-11T19:45:26ZDifficulty with a form<div><p>Atttaching xml example</p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/320411262014-03-12T12:38:25Z2014-03-12T12:38:25ZDifficulty with a form<div><p>Hi Jim,</p>
<p>Just to clarify, you are looking to output the contents of the
<code><form></code> element using Velocity? If so, have you
tried using the SerializerTool to output the content? For
example:</p>
<pre>
<code>#set ($form = $callingPageSD.getChild("form"))
$_SerializerTool.serialize($form, true)</code>
</pre>
<p>If you still encounter render errors, perhaps try surrounding
the output of the form with a <code>#protect</code> <a href=
"http://www.hannonhill.com/kb/Code-Sections/#protect-code-sections">
code section</a>.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/320411262014-03-12T13:13:00Z2014-03-12T13:13:00ZDifficulty with a form<div><p>I've tried both. When using the serializer alone, I get an error
saying it can't find the tag:</p>
<p>An error occurred: Could not transform with Script format
"_internal/formats/form-page/form": Error on line 308: The element
type "form" must be terminated by the matching end-tag "".</p>
<p>When I add the protect tag, I get:</p>
<p>An error occurred: Could not transform with Script format
"_internal/formats/form-page/form": Error on line 6: The string
"--" is not permitted within comments.</p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/320411262014-03-12T13:29:01Z2014-03-12T13:29:01ZDifficulty with a form<div><p>Hm, looks like my sample code was a little off. You would want
something more like the following:</p>
<pre>
<code>#set ($form = $callingPageSD.getChild("form").getChild("content"))
$_SerializerTool.serialize($form, true)</code>
</pre>
<p>Perhaps give that a try and let me know how it works out.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/320411262014-03-12T13:53:02Z2014-03-12T13:53:02ZDifficulty with a form<div><p>Ryan,<br>
I had corrected for that:</p>
<p>#set ($form = $_XPathTool.selectSingleNode($contentRoot,
"/system-index-block/calling-page/system-page/system-data-structure/form/content"))</p>
<!--#protect $_SerializerTool.serialize($form, true)
#protect-->
<p>Still the errors are as before.</p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/320411262014-03-12T19:08:54Z2014-03-12T19:08:54ZDifficulty with a form<div><p>Hm, I was not able to reproduce this in my local Cascade Server
7.10 instance. Here are the steps I used to reproduce:</p>
<ul>
<li>Uploaded your sample XML as an XML Block</li>
<li>Created the following Velocity Format:
<pre>
<code>#set ( $callingPageSD = $_XPathTool.selectSingleNode($contentRoot, "//calling-page/system-page/system-data-structure") )
#set ($form = $callingPageSD.getChild("form").getChild("content"))
$_SerializerTool.serialize($form, true)</code>
</pre></li>
<li>Attached both the block and format to a page region</li>
<li>Previewed the page and the form rendered as expected.</li>
</ul>
<p>I have a few additional questions to see if we can narrow things
down a bit:</p>
<ul>
<li>What version of Cascade Server are you currently running?</li>
<li>How are you applying this Format? Can you describe how things
are set up?</li>
<li>Do you have any XSLT Formats applied at the page, template, or
configuration set level that may be affecting the output of the
page?</li>
</ul>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/320411262014-03-17T15:36:54Z2014-03-17T15:36:54ZDifficulty with a form<div><p>Hi Jim,</p>
<p>Just wanted to follow up to see if you had a chance to view my
<a href=
"http://help.hannonhill.com/discussions/velocity-formats/9387-difficulty-with-a-form#comment_32065185">
recent comment</a>. Were you able to get your form HTML to output
correctly?</p>
<p>Please let us know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/320411262014-03-17T15:48:54Z2014-03-17T15:48:54ZDifficulty with a form<div><p>Ryan,</p>
<p>Sorry I didn’t get back to you. The script you sent did
work fine. For the life of me I can’t figure out why mine
didn’t. This isn’t a difficult script and to my eye,
what I did was the same as what you sent. Mysteries of life. Thanks
for your help as always.</p>
<p>Jim</p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/320411262014-03-17T19:00:48Z2014-03-17T19:00:48ZDifficulty with a form<div><p>Thank you for following up, Jim. I am glad to hear you were able
to get things working.</p>
<p>Have a great day!</p></div>Ryan Griffith