Difficulty with a form
Good day. We have a vendor who is creating forms for tracking inquiries. Until now, for simplicity sake and because the vendor often uses sloppy code, we've been editing them in html and publishing them.
As the use of these is going to increase and there is information on the pages that will be edited we're trying to Cascade so we can drop the form into a region and allow the users to edit the text in the other regions as needed.
I set up a data definition with a WYSIWYG region for inserting the text. I have not yet been able to write a script to properly render a working form, getting various errors depending on what non-working script I'm trying. I've tried escaping, protecting, passing through, all to no avail.
I've attached a working html form. Can you suggest how i would render this in Velocity using a data definition?
- work.html 60.4 KB
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by steelej on 11 Mar, 2014 07:45 PM
Atttaching xml example
2 Posted by Ryan Griffith on 12 Mar, 2014 12:38 PM
Hi Jim,
Just to clarify, you are looking to output the contents of the
<form>
element using Velocity? If so, have you tried using the SerializerTool to output the content? For example:If you still encounter render errors, perhaps try surrounding the output of the form with a
#protect
code section.Please let me know if you have any questions.
Thanks!
3 Posted by steelej on 12 Mar, 2014 01:13 PM
I've tried both. When using the serializer alone, I get an error saying it can't find the </form> tag:
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 "".
When I add the protect tag, I get:
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.
4 Posted by Ryan Griffith on 12 Mar, 2014 01:29 PM
Hm, looks like my sample code was a little off. You would want something more like the following:
Perhaps give that a try and let me know how it works out.
Please let me know if you have any questions.
Thanks!
5 Posted by steelej on 12 Mar, 2014 01:53 PM
Ryan,
I had corrected for that:
#set ($form = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block/calling-page/system-page/system-data-structure/form/content"))
<!--#protect
$_SerializerTool.serialize($form, true)
#protect-->
Still the errors are as before.
6 Posted by Ryan Griffith on 12 Mar, 2014 07:08 PM
Hm, I was not able to reproduce this in my local Cascade Server 7.10 instance. Here are the steps I used to reproduce:
I have a few additional questions to see if we can narrow things down a bit:
Please let me know if you have any questions.
Thanks!
7 Posted by Ryan Griffith on 17 Mar, 2014 03:36 PM
Hi Jim,
Just wanted to follow up to see if you had a chance to view my recent comment. Were you able to get your form HTML to output correctly?
Please let us know if you have any questions.
Thanks!
8 Posted by steelej on 17 Mar, 2014 03:48 PM
Ryan,
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.
Jim
9 Posted by Ryan Griffith on 17 Mar, 2014 07:00 PM
Thank you for following up, Jim. I am glad to hear you were able to get things working.
Have a great day!
Ryan Griffith closed this discussion on 17 Mar, 2014 07:00 PM.