You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ho...@seitenbau.com on 2004/03/01 10:13:07 UTC

Re: Coplets in cocoon

Hi Anna,

the name of the fields inside the form can be the same. You can even use 
the same coplet inside one page. What needs to be different is the id of 
the coplet-instance-data.(Configure it in 
profiles/copletinstancedate/portal.xml and use it in 
profiles/layout/portal.xml)

Nicole

Re: Coplets in cocoon

Posted by Anna Bikkina <an...@pinksheets.com>.
It finally worked

Thanks for the help

Anna


On Tuesday 02 March 2004 10:50 am, Hochleiter@seitenbau.com wrote:
> Hi Anna,
> It's right, that both forms get executed. If you study the example I sent,
> you see that the decision which form would be executed, is made by a
> parameter that sits in the session (and is written to the session by the
> script).
> So it's the same with your forms. Both will be executed. But you will need
> one parameter - could be a hidden field - which you check in the
> coresponding xsp. Than you know if the xsp needs to be executed.
>
> So the conclusion is, you have to care for it on your own, that the right
> form (and coresponding script) get executed.
> I hope this helps.
>
> regards,
> Nicole


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Coplets in cocoon

Posted by Philippe Guillard <pg...@soociety.com>.
I had the same problem on tuesday, and the problem was solved when i
used this
http://wiki.cocoondev.org/Wiki.jsp?page=WoodyCopletForPortalEngine check
new "New way". Use temporary:application-uri instead of uri.

Works perfectly except javascript in the woody form like showPopup
function or ctyselector sample stuff not launched from the coplet, so in
case you or somebody nows how to manage that let me know! 

Phil

On Tue, 2004-03-02 at 23:50, Hochleiter@seitenbau.com wrote:
> Hi Anna,
> It's right, that both forms get executed. If you study the example I
> sent, you see that the decision which form would be executed, is made
> by a parameter that sits in the session (and is written to the session
> by the script).
> So it's the same with your forms. Both will be executed. But you will
> need one parameter - could be a hidden field - which you check in the
> coresponding xsp. Than you know if the xsp needs to be executed.
> 
> So the conclusion is, you have to care for it on your own, that the
> right form (and coresponding script) get executed.
> I hope this helps.
> 
> regards,
> Nicole


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Coplets in cocoon

Posted by Ho...@seitenbau.com.
Hi Anna,
It's right, that both forms get executed. If you study the example I sent, 
you see that the decision which form would be executed, is made by a 
parameter that sits in the session (and is written to the session by the 
script).
So it's the same with your forms. Both will be executed. But you will need 
one parameter - could be a hidden field - which you check in the 
coresponding xsp. Than you know if the xsp needs to be executed.

So the conclusion is, you have to care for it on your own, that the right 
form (and coresponding script) get executed.
I hope this helps.

regards,
Nicole

Re: Coplets in cocoon

Posted by Anna Bikkina <an...@pinksheets.com>.
Both my forms have different actions. 

Security.xsp
           <form href="cocoon:/coplets/search/securityresult.xsp" 
method="post">
           		<input type="hidden" name="visited" value="true"/>
           		<!-- also store username or session id here-->
           		<input type="hidden" name="name">


MarketMaker.xsp


           <form href="cocoon:/coplets/search/marketmakerresult.xsp" 
method="post">
           		<input type="hidden" name="visited" value="true"/>
           		<!-- also store username or session id here-->
           		<input type="hidden" name="name">
           			<xsp:attribute name="value"><xsp-ses


Here is my sitemap

    <map:match pattern="security.xsp">    	
	     <map:generate src="securityresult.xsp" type="serverpages"/>     	
 	    <map:transform src="context:/historyserver/styles/search.xsl"/>          
  	   <map:serialize/>    
   </map:match>


    <map:match pattern="markermaker.xsp">    	
	     <map:generate src="marketmakerresult.xsp" type="serverpages"/>     	
 	    <map:transform src="context:/historyserver/styles/search.xsl"/>          
  	   <map:serialize/>    
   </map:match>


I am not using the call function like you mentioned in the example. I guess 
thats ok. 
coplet-data

 <coplet-data id="security" name="standard">
      <title>Security Quote History</title>
      <coplet-base-data>URICoplet</coplet-base-data>
      <attribute>
      	<name>uri</name>
      	<value xsi:type="java:java.lang.String" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/search/security.xsp</
value>
      </attribute>
   </coplet-data>      
   <coplet-data id="marketmaker" name="standard">
      <title>Market Maker Quotes List</title>
      <coplet-base-data>URICoplet</coplet-base-data>
      <attribute>
      	<name>uri</name>
      	<value xsi:type="java:java.lang.String" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/search/marketmaker.xsp</
value>
      </attribute>
   </coplet-data>
   

coplet instance data

   <coplet-instance-data id="security-1" name="standard">
      <coplet-data>security</coplet-data>
   </coplet-instance-data>
   <coplet-instance-data id="marketmaker-2" name="standard">
      <coplet-data>marketmaker</coplet-data>
   </coplet-instance-data>

Can you please help me find the problem.

Thanks,
Anna.





On Monday 01 March 2004 12:46 pm, Hochleiter@seitenbau.com wrote:
> cop


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Coplets in cocoon

Posted by Ho...@seitenbau.com.
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" 
value="{request-param:copletid}"/>
        </map:call>
      </map:match>


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 
somehow.

Re: Coplets in cocoon

Posted by Anna Bikkina <an...@pinksheets.com>.
Thank you for the reply. 

I gave different id's for my coplet but still the same problem

This is in my coplet-instance-data. 

   <coplet-instance-data id="security-1" name="standard">
      <coplet-data>security</coplet-data>
   </coplet-instance-data>
   <coplet-instance-data id="marketmaker-1" name="standard">
      <coplet-data>marketmaker</coplet-data>
   </coplet-instance-data>


This is my coplet data code

<coplet-data id="security" name="standard">
      <title>Security Quote History</title>
      <coplet-base-data>URICoplet</coplet-base-data>
      <attribute>
      	<name>uri</name>
      	<value xsi:type="java:java.lang.String" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/search/security.xsp</
value>
      </attribute>
   </coplet-data>      
   <coplet-data id="marketmaker" name="standard">
      <title>Market Maker Quotes List</title>
      <coplet-base-data>URICoplet</coplet-base-data>
      <attribute>
      	<name>uri</name>
      	<value xsi:type="java:java.lang.String" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/search/marketmaker.xsp</
value>
      </attribute>
   </coplet-data>

Am I making any mistake. Please let me know.

Thanks,
Anna


On Monday 01 March 2004 04:13 am, Hochleiter@seitenbau.com wrote:
> Hi Anna,
>
> the name of the fields inside the form can be the same. You can even use
> the same coplet inside one page. What needs to be different is the id of
> the coplet-instance-data.(Configure it in
> profiles/copletinstancedate/portal.xml and use it in
> profiles/layout/portal.xml)
>
> Nicole


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org