AnsweredAssumed Answered

HTML in a Web Form

Question asked by kramoutar on Oct 22, 2009
Latest reply on Nov 9, 2009 by kramoutar
Hi there,

I have a web form with one element, xs:string, that can be populated with either text or HTML.  My rendering template takes the info in this element and wraps it in an XML node for integration with a web app.  I'm noticing that upon save, Alfresco surrounds the text with <p>…</p> AND that even with disable-output-escaping set to yes, if HTML is entered, the tags aren't escaped, they're rendered into &lt; instead of <.

Here's an example:

Content entered into Web Form field:
<p>Thank you for creating an account. Take a tour of the account features that may make your shopping experience more enjoyable.</p>
      <dl>
       <dt>Order History</dt>
       <dd>
        <p>Review previous orders, reorder items that you have purchased previously, and review the status of your orders.</p>
        <p><a href="OrderHistoryView">Start Now</a></p>
       </dd>
      
       <dt>Wishlist</dt>
       <dd>
        <p>Create a wishlist of items that you wish to purchase.</p>
        <p><a href="InterestItemDispay">Start Now</a></p>
       </dd>

       <dt>Address Book</dt>
       <dd>
        <p>Provide your address information now to speed up your checkout process.</p>
        <p><a href="AddressBookView">Start Now</a></p>
       </dd>

       <dt>Billing Information</dt>
       <dd>
        <p>Store your credit card information in our secure system to make purchasing products a breeze.</p>
        <p><a href="#">Start Now</a></p>
       </dd>

       <dt>Account Information</dt>
       <dd>
        <p>Update your email address and account password</p>
        <p><a href="EditAccountInformationView">Start Now</a></p>
       </dd>
      </dl>
XSLT Snippet:
<xsl:value-of disable-output-escaping="yes" select="." />
Output XML Doc Snippet:
<body><p>      &lt;p&gt;Thank you for creating an account. Take a tour of the account features that may make your shopping experience more enjoyable.&lt;/p&gt;<br />      &lt;dl&gt;<br />       &lt;dt&gt;Order History&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Review previous orders, reorder items that you have purchased previously, and review the status of your orders.&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="OrderHistoryView"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;<br />       <br />       &lt;dt&gt;Wishlist&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Create a wishlist of items that you wish to purchase.&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="InterestItemDispay"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;</p> <p>       &lt;dt&gt;Address Book&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Provide your address information now to speed up your checkout process.&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="AddressBookView"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;</p> <p>       &lt;dt&gt;Billing Information&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Store your credit card information in our secure system to make purchasing products a breeze.&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="#"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;</p> <p>       &lt;dt&gt;Account Information&lt;/dt&gt;<br />       &lt;dd&gt;<br />        &lt;p&gt;Update your email address and account password&lt;/p&gt;<br />        &lt;p&gt;&lt;a href="EditAccountInformationView"&gt;Start Now&lt;/a&gt;&lt;/p&gt;<br />       &lt;/dd&gt;<br />      &lt;/dl&gt;</p></body>

Can someone help me get rid of the <p> and also figure out how to escape the HTML in the output?

Thanks in advance.

Outcomes