AnsweredAssumed Answered

WCM Forms Guide on the WIKI

Question asked by jconnell on Jan 11, 2007
Latest reply on Jan 12, 2007 by arielb
Hey Alfresco Team,

I've been experimenting with XForms support from SVN HEAD revision (as of this morning).   I've noticed that the documentation on the wiki might be out of date.  I've started updating the wiki page at http://wiki.alfresco.com/wiki/WCM_Forms_Guide, to reflect how it currently works.  I just wanted to verify that current behavior is the intended behavior before I finish updating the page.

To give an example of one discrepency I've found, the current docs show how you can reference the Forms data in a Freemarker template.  Unfortunately, it seems that you have to use Freemarker namespaces to access the content.  I've found the following works:

Suppose your XForm produces something like the following:


<!– some namespaces excluded from example –>
<?xml version="1.0" encoding="UTF-8"?>
<cms:article xmlns:cms="http://mycms.org/cms"
   xmlns:alf="http://www.alfresco.org">
   <cms:title>Article 1</cms:title>
   <cms:date>2007-01-10</cms:date>
   <cms:location>New York, New York</cms:location>
   <cms:body>
      Here&amp;#39;s my article.&amp;nbsp; I hope it works out!
   </cms:body>
</cms:article>

To access that content using the FM rendering engine, you actually have to do the following:

<#ftl ns_prefixes={"cms":"http://mycms.org/cms"}>
<#assign article = .vars["cms:article"]>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   <head>
      <title>${article["cms:title"]}</title>
   </head>
   <body>
      <h1>${article["cms:title"]}</h1>

      <div id="articleContent">
         <span>(${article["cms:location"]} – ${article["cms:date"]})</span>
         ${article["cms:body"]}
      </div>
   </body>
</html>

If the current behavior is correct, I'd love to update the wiki so that everybody else can start experimenting with the WCM stuff right away.

JC

Outcomes