You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Kamal Bhatt <kb...@tt.com.au> on 2006/07/26 09:25:52 UTC

Cforms and website.

Hi
I want to create a webpage that aggregates a cform with other static 
elements. It all works as expected in authoring, but when it is in live 
the cform does not refresh or send the email (the purpose of the form). 
It simply returns to the original page. As far as I can see there is no 
difference in the javascript files and I do not have specific references 
to live and authoring in any of the code that is called..

To do this I have created the following pipelines:

    <map:match pattern="lenya-document-*/*/**/index/index_en.xml">
    <map:aggregate element="pagebody">
        <map:part src="xml/home_head.xml"/>
        <map:part src="xml/home_map.xml"/>
        <map:part src="cocoon:/search-boxes"/>
        <map:part src="cocoon:/wrapcolumn-icreate-promotionLeft-Two"/>
        <map:part src="cocoon:/wrapcolumn-agentlogin-promotionRight-Three"/>
        <map:part src="cocoon:/competition"/>
        <map:part src="xml/lp_bottom.xml"/>
    </map:aggregate>
    <map:serialize type="xml"/>
      </map:match>

...

    <map:pipeline type="noncaching">

    <map:match pattern="display-pipeline">
        <map:generate type="jx" src="cforms/earlybird_template.xml"/>
        <map:transform src="xslt/form/forms-tile-styling.xsl">
            <map:parameter name="root" 
value="/cms/{page-envelope:publication-id}/{page-envelope:area}"/>
        </map:transform>   
        <map:serialize/>
    </map:match>
      <map:match pattern="competition">
        <map:select type="parameter">
      <map:parameter name="parameter-selector-test" 
value="{request-param:continue}"/>
      <map:when test="">
          <map:call function="ebRequest"/>
      </map:when>
          <map:otherwise>
          <map:call continuation="{request-param:continue}"/>
          </map:otherwise>
         </map:select>     
      </map:match>

    <map:match pattern="call-*-*">
        <map:generate src="cocoon:/{1}-{2}"/>
        <map:serialize type="xml"/>

    </map:match>

    <map:match pattern="success-pipeline">
            <map:act type="sendmail">
            <map:parameter name="from" 
value="hometheatreincentive@creativeholidays.com.au"/>
                <map:parameter name="to" value="kbhatt@tt.com.au"/>
<!--            <map:parameter name="to" 
value="marketing@creativeholidays.com.au"/> -->
       
        <map:parameter name="attachments" value=""/>
        <map:parameter name="subject" value="{flow-attr:subject}"/>
        <map:parameter name="body" value="{flow-attr:body}"/>
        <map:generate type="file" src="xml/earlybird_success.xml"/>
        <map:serialize type="xml"/>
        </map:act>   
    </map:match>
     </map:pipeline>   

The forms-tile-styling.xsl is simply the forms-sample-styling except it 
does not process head and it does not bound everything in a body.

and the following template:

<div id="body">

    <jx:import xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
           
uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
    <ft:form-template
      xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
      xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
      xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
      method="POST" action="index.html?continue=#{$continuation/id}">
          <ft:continuation-id/>
    <div id="theatre">
        <img src="images/home_theatre/hd_home_theatre.gif" alt="Home 
Theatre a Day" width="325" height="48"/>
        <div id="stero"><img src="images/home_theatre/hd_10_week.gif" 
alt="10 Week Giveaway" width="145" height="29"/></div>
        <p><strong>DON'T FORGET</strong> - If your booking was made via 
i-create you are eligible for DOUBLE ENTRY. You must
        register your booking twice.</p>
            <img src="images/home_theatre/gr_iCreate.gif" alt="i-Create" 
id="icreate" />
        <div class="clearFive"></div>
       
        <div id="promotionform">
            <div id="padding">
            <div class="required">* Required information</div>
            <fi:group>
            <fi:hint>Feather your nest</fi:hint>
            <fi:styling layout="columns" class="formTable"/>
            <fi:items>
              <ft:widget id="consultant"><fi:styling label-class="left" 
class="default"/></ft:widget>
              <ft:widget id="agent"><fi:styling label-class="left" 
class="default"/></ft:widget>
              <ft:widget id="booking"><fi:styling label-class="left" 
class="default"/></ft:widget>
              <ft:widget id="destination"><fi:styling 
list-type="checkbox" label-class="left" class="default"/></ft:widget>
              <ft:widget id="email"><fi:styling label-class="left" 
class="default"/></ft:widget>
              <ft:widget id="submit"/>
            </fi:items>
              </fi:group>
            <div class="clear"></div>
        </div>   
        </div>   
    </div>   
    </ft:form-template>
    <div class="clear"></div>
</div>

And finally the flow:

function ebRequest()
{
    var form = new Form("cforms/earlybird.xml");
cocoon.log.error("Hello\n");   
    // show the form to the user until it is validated successfully
   
    form.showForm("call-display-pipeline");
  
    var model = form.getModel();
  
    var body = "Consultant Name: " + model.consultant + "\n";
    body = body + "Agency Name: " + model.agent + "\n";
    body = body + "Booking Number: " + model.booking + "\n";
   
    body = body + "Destination(s):"
   
    for (var i = 0; i < model.destination.length; i++) 
    body = body + model.destination[i] + " ";
   
    body = body + "\nEmail Address: " + model.email + "\n";
   
    var subject = "Agent Incentives";   
    var bizdata = {
              "body": body,
              "subject" : subject      
              }
    cocoon.sendPage("call-success-pipeline", bizdata);
}

-- 
Kamal Bhatt


--
Disclaimer: This email is confidential and may contain privileged information for the sole use of the person or business to which it is addressed. If you are not the intended recipient, please notify the sender by return e-mail or phone as you must not view, disseminate, distribute or copy this email without our consent. We do not accept any liability in connection with any computer virus, data corruption, incompleteness, or unauthorised amendment of this email. It is the sole responsibility of the receiver to scan for viruses before opening.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Nevermind

Posted by Kamal Bhatt <kb...@tt.com.au>.
This is the fault of caching.

-- 
Kamal Bhatt


--
Disclaimer: This email is confidential and may contain privileged information for the sole use of the person or business to which it is addressed. If you are not the intended recipient, please notify the sender by return e-mail or phone as you must not view, disseminate, distribute or copy this email without our consent. We do not accept any liability in connection with any computer virus, data corruption, incompleteness, or unauthorised amendment of this email. It is the sole responsibility of the receiver to scan for viruses before opening.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Cforms and website.

Posted by Kamal Bhatt <kb...@tt.com.au>.
Forgot to mention, I am using Lenya 1.2.3 and I did include forms-lib.js.
>


-- 
Kamal Bhatt


--
Disclaimer: This email is confidential and may contain privileged information for the sole use of the person or business to which it is addressed. If you are not the intended recipient, please notify the sender by return e-mail or phone as you must not view, disseminate, distribute or copy this email without our consent. We do not accept any liability in connection with any computer virus, data corruption, incompleteness, or unauthorised amendment of this email. It is the sole responsibility of the receiver to scan for viruses before opening.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org