Re: portal+cform+ajax problem in 2.1.8 rc1
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/
Re: portal+cform+ajax problem in 2.1.8 rc1
Hi,Philippe GASSMANN I test it in sample,it works,I will test it in my project.Thanks a lot. Roy Huang
portal+cform+ajax problem in 2.1.8 rc1
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: 1.change block portal in samples,copletdata.xml,config like: coplet-data id=app-test-two name=standard titleApplication Test/title coplet-base-dataCachingURICoplet/coplet-base-data attribute namebuffer/name value xsi:type=java:java.lang.Booleantrue/value /attribute attribute namehandleParameters/name value xsi:type=java:java.lang.Booleantrue/value /attribute attribute nameuri/name value xsi:type=java:java.lang.Stringcocoon:/coplets/html/application/value /attribute attribute nametemporary:application-uri/name value xsi:type=java:java.lang.Stringcocoon://samples/blocks/forms/do-datasourceChooser.flow/value /attribute /coplet-data I just point the url to a form ajax sample 2.change portal skin files to make form render correctly. 3.change form block datasource_chooser_template.xml,from ft:form-template action=#{$cocoon/continuation/id}.continue method=POST ajax=true to ft:form-template action=continue method=POST ajax=true ajax-action=/samples/blocks/forms/continue ft:continuation-id/ this change will still make the sample run good. 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. Regards Roy Huang _ 享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com
Re: portal+cform+ajax problem in 2.1.8 rc1
黄 海冬 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 -- Sylvain WallezAnyware Technologies http://people.apache.org/~sylvain http://www.anyware-tech.com Apache Software Foundation Member Research Technology Director