Hi!

I just combine CForm to portal in 2.1.10, everything is good, include pojo and
ajax, but in ajax mode, the portal won't cache the cform's data will try to
solve it. here is the step.

1. because of lacking of javascript in portal, I put some java script to
portal-page.xsl in skins\common\styles.

<xsl:param name="resources-uri">resources</xsl:param>
<xsl:param name="user"/>
<xsl:param name="title"/>
<xsl:param name="base"/>

<xsl:template match="/">
  <html>
    <head>
                        <title><xsl:value-of select="$title"/></title>
    <script src="{$resources-uri}/dojo/dojo.js" type="text/javascript"/>
    <script src="{$resources-uri}/ajax/cocoon.js" type="text/javascript"/>
    <script src="{$resources-uri}/forms/js/forms-lib.js" 
type="text/javascript"/>
    <script type="text/javascript">
        dojo.addOnLoad(forms_onload);
        dojo.require("cocoon.forms.*");
    </script>
    <link rel="stylesheet" type="text/css"
href="{$resources-uri}/forms/css/forms.css"/>
    <script src="{$resources-uri}/forms/mattkruse-lib/AnchorPosition.js"
type="text/javascript"/>
    <script src="{$resources-uri}/forms/mattkruse-lib/PopupWindow.js"
type="text/javascript"/>
    <script src="{$resources-uri}/forms/mattkruse-lib/OptionTransfer.js"
type="text/javascript"/>
    <script src="{$resources-uri}/forms/mattkruse-lib/selectbox.js"
type="text/javascript"/>
    <script src="{$resources-uri}/forms/mattkruse-lib/CalendarPopup.js"
type="text/javascript"/>
    <script src="{$resources-uri}/forms/mattkruse-lib/date.js"
type="text/javascript"/>
    <script type="text/javascript">
      // Setup calendar
      var forms_calendar = CalendarPopup();
      forms_calendar.setWeekStartDay(1);
      forms_calendar.showYearNavigation();
      forms_calendar.showYearNavigationInput();
      forms_calendar.setCssPrefix("forms_");
    </script>
    <link rel="stylesheet" type="text/css"
href="{$resources-uri}/forms/css/forms-calendar.css"/>
    <script type="text/javascript">
      _editor_url = "<xsl:value-of select="concat($resources-uri,
'/forms/htmlarea/')"/>";
      _editor_lang = "en";
    </script>
    <script type="text/javascript"
src="{$resources-uri}/forms/htmlarea/htmlarea.js"></script>
      <link type="text/css" rel="stylesheet" href="{$base}css/page.css"/>
      <link type="text/css" rel="stylesheet" href="{$base}css/wsrp.css"/>
    </head>

here I add a param "resources-uri" and copy the javascript that CForm will use.

2. add the param "resources-uri" to portal-page transform in the sitemap.xmap of
portal.

        <map:transform src="{portal-skin:skin.basepath}/styles/portal-page.xsl">
          <map:parameter name="resources-uri"
value="{request:contextPath}/_cocoon/resources"/>
          <map:parameter name="user" value="{ID}"/>
          <map:parameter name="title" value="{global:mainTitle}"/>
          <map:parameter name="base" value="{portalpath:relative}"/>
        </map:transform>

3. put the ajax form into the coplets directory, and modify the proper 
portal.xml.

4. modify the template to use ajax (optional).

    <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"
ajax="true"
ajax-action="/cocoon/portal/coplets/forms/#{$cocoon/continuation/id}.continue">


that's all, enjoy it.

johnson



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to