cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Coplets in cocoon
Date Mon, 01 Mar 2004 17:46:28 GMT
Is it possible that both forms react on the same action? This would 
explain the problem.
In this case you could e.g. use a flowscript to consider which coplet was 
send (with the copletId) and then save the state in the session.

e.g. you have 
<form method="post" action="form">...</form>

then you have am matcher for "form" in your sitemap that could call a 
flowscript function
      <map:match pattern="form">
        <map:call function="form">
          <map:parameter name="copletId" 

and the function could look like this:
function form() {
    // get the coplet id
    var cid = cocoon.parameters["copletId"];
    var pname = cid + "/myform";

    if ( cocoon.session.getAttribute(pname) == null ) {
        var name = cocoon.request.getParameter("name");
        if ( name == null ) {
            cocoon.sendPage("page/form", {});
        } else {
            cocoon.session.setAttribute(pname, name);
            cocoon.sendPage("page/received", {"name" : name}); 
    } else {
        var name = cocoon.session.getAttribute(pname);
        cocoon.sendPage("page/content", {"name" : name}); 

where page/form, page/received and page/content have to be in you sitemap 
View raw message