Sylvain Wallez wrote:
黄 海冬 wrote:
  
Hi,all
I try to combine portal+form(with ajax) in 2.1.8 rc1,all is fine but
one problem,I don't know if is a bug,and just show my step here:
    

<snip/>

  
Now I run the server and enter portal block sample,it works fine only
when finally I click "ok" button.
If it is not a ajax form or run the form seperatly,I should see the
result information,but now I see the form restart.
I check the aceess log and add some debug code in js file,the
flowscript did't run after
form.showForm("datasource_chooser-display-pipeline.jx");
and the seperate form sample will run continue twice when I click "ok"
but only once under this condition.
I guess the ajax code missing one click to make showForm complete in
this situation,so it may be a bug.
    

Well, my colleagues that succeeded in using CForms+Ajax in the portal
told me this is much more complicated than that, and I shamely admit
that I haven't understood their explanations.

So it's not really a bug: the CForms+Ajax coplets must be written in a
very special way. I'll try to have a better answer tomorrow, as we're
here past the work hours now.

Sylvain

  
Hi, I will try to give you an explanation of how it can be done :
 1. the pipeline called by the coplet containing the form is something like this :

<map:match pattern="myForm">
    <map:select type="request-method">
            <map:when test="GET">
                <map:call function="MyFlowFunctionThatCreateAndDisplayTheForm">
             </map:when>
             <map:otherwise>
                <map:call continuation="{request-param:continuation-id}"/>
             </map:otherwise>
    </map:select
</map:select>

 2. the pipeline showing the form is somewhat like this :
    <map:patch pattern="showMyForm">
        <map:generate type="jx" src=""/>
        <map:transform type="browser-update"/>
         
        <map:transform type="i18n" label='i18n'>
            <map:parameter name="locale" value="{session-context:authentication/authentication/data/lang}"/>
        </map:transform>
   
        <map:transform src="" label='forms-xsl'>
            <map:parameter name="contextPath" value="{request:contextPath}"/>
            <map:parameter name="lang" value="{session-context:authentication/authentication/data/lang}"/>
       </map:transform>

     <map:select type="request-parameter">
        <map:parameter name="parameter-name" value="cocoon-ajax"/>
        <map:when test="true">
            <map:serialize type="xml"/>
        </map:when>
        <map:otherwise>
            <map:serialize type='xhtml'/>
        </map:otherwise>
    </map:select>
   </map:match>

3. In the template :
    <ft:form-template action=""  enctype="multipart/form-data" method="POST" ajax="true"
          ajax-action=""/>


Note :
 - I assume that these pipeline are in the portal sitemap. If not, just modify ajax-action
 - We do not use the temporary attribute "application-uri". (the uri of the coplet is always cocoon://portal/myForm in this case)

I think that's all.

Good luck !

-- 
Philippe GASSMANN
ANYWARE TECHNOLOGIES
http://www.anyware-tech.com/

Reply via email to