Date: 2004-10-25T08:28:32
   Editor: VladTanasescu <[EMAIL PROTECTED]>
   Wiki: Cocoon Wiki
   Page: WoodyCopletForPortalEngine
   URL: http://wiki.apache.org/cocoon/WoodyCopletForPortalEngine

   Warning about complete html pages for coplets

Change Log:

------------------------------------------------------------------------------
@@ -6,17 +6,17 @@
 [[BR]]
 '''Step 1:''' The first step is to modify one existing coplet to use a woody 
form.
 Edit the {{{portal/layout/copletdata/portal.xml}}} file and change the value 
of the uri of the Portal-Demo with 
{{{cocoon://samples/woody/registration}}}.[[BR]]
-{{{
-...
-<coplet-data id="Portal-demo" name="standard">
-  ...
-  <value xsi:type="java:java.lang.string"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
-    cocoon://samples/woody/registration
-  </value>
-  ...
-</coplet>
-...
+{{{
+...
+<coplet-data id="Portal-demo" name="standard">
+  ...
+  <value xsi:type="java:java.lang.string"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+    cocoon://samples/woody/registration
+  </value>
+  ...
+</coplet>
+...
 }}}
 Log into the portal as guest/guest and in the main tab instead of the 
introduction coplet, you will ses the woody form.[[BR]]
 Now the problem is that the !KontId isn't handling. It's always the same uri 
called for this coplet. The simplest trick will be to put the KontID in an 
hidden filed and change the woody sitemap to handle it.[[BR]]
@@ -24,26 +24,26 @@
 '''Step 2:''' Add the continuation hidden field. Edit the 
{{{woody/forms/registration_template.xml}}} and add after 
{{{wt:form-template}}} the tag
 {{{<wt:continuation-id/>}}}
 Then set the form action to an empty string, because we want use the portal 
page, not just the form. Your file should look like[[BR]]
-{{{<page ...
-<content>
-  <wt:form-template action="" method="POST">
-    <wt:continuation-id/>
-    <wt:widget-label id="name"/>
-...</page>
+{{{<page ...
+<content>
+  <wt:form-template action="" method="POST">
+    <wt:continuation-id/>
+    <wt:widget-label id="name"/>
+...</page>
 }}}
 [[BR]]
 '''Step 3:''' Configure the sitemap to handle the continuation. we gonna 
switch the pipeline based on the request method.
 Edit the woody/sitemap.xmap and replace the match pattern registration 
with[[BR]]
-{{{<map:match pattern="registration">
-  <map:select type="request-method">
-    <map:when test="GET">
-      <map:call function="registration"/>
-    </map:when>
-    <map:when test="POST">
-      <map:call continuation="{request-param:continuation-id}"/>
-    </map:when>
-  </map:select>
-</map:match>
+{{{<map:match pattern="registration">
+  <map:select type="request-method">
+    <map:when test="GET">
+      <map:call function="registration"/>
+    </map:when>
+    <map:when test="POST">
+      <map:call continuation="{request-param:continuation-id}"/>
+    </map:when>
+  </map:select>
+</map:match>
 }}}
 That's all. Right now you can enjoy the woody inside a Coplet.[[BR]]
 [[BR]]
@@ -65,10 +65,23 @@
 [[BR]]
 '''However''': your form must specify an {{{action}}}, i.e. page that it 
submits to.  The normal behaviour of a form with no {{{action}}} is that it 
submits back to itself, but this won't work with the Application coplet 
adaptor.  This is so that the coplet adaptor can change the value of 
{{{action}}} so it can make sure that the rest of your portal loads around your 
coplet when you submit your form.[[BR]]
 e.g.
-{{{
-<form method="post" action="submitpage">
- <!-- [...] -->
-</form>
+{{{
+<form method="post" action="submitpage">
+ <!-- [...] -->
+</form>
 }}}
 [[BR]]
 JonEvans
+
+[[BR]]
+'''Beware!''': your form must be a valid html page in order to be accepted by 
a coplet. The {{{forms-samples-styling.xsl}}} stylesheet of the distribution 
formats a form in this way:[[BR]]
+{{{
+<form ...>
+ <!-- [...] -->
+</form>
+}}}
+[[BR]]
+You have to modify the stylesheet in order to add the {{{html}}} and 
{{{head}}} and {{{body}}} tags if you want your form to appear in a coplet.
+[[BR]]
+VladTanasescu
+