[opencms-dev] contact us form not working in online project

Irene Santerini i.santerini at inera.it
Wed Feb 26 09:37:27 CET 2003


Hi  Aaron,

I've implemented a form to send email (OpenCms 4.6). 
The element.cache variable is set to true in my opencms.properties file.

I've used the method "getCacheDirectives" in this way:


 public CmsCacheDirectives getCacheDirectives(
             CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector) {

   Vector para = new Vector();

   // new object CmsCacheDirectives
   CmsCacheDirectives cd = new CmsCacheDirectives(true,false,false,false,true);

   para.addElement("action");
   // my form parameters
   para.addElement("name"); 
   para.addElement("tel");
   para.addElement("e_mail");
   para.addElement("address");

   cd.setNoCacheParameters(para);

   cd.renewAfterEveryPublish();

   return cd;

  }

I hope this can help you.

Irene

  ----- Original Message ----- 
  From: astaffo2 at csc.com.au 
  To: opencms-dev at www.opencms.org 
  Sent: Wednesday, February 26, 2003 4:23 AM
  Subject: Re: [opencms-dev] contact us form not working in online project



  Further to my last email regarding my cache issue: 

  We're running ocms 5RC2 

  We are currently extending the CmsXmlTemplate (eg. CmsXmlTemplateX) and use it for the frame template and the content template. 

  The element used for the form extends the CmsXmlTemplateX class. 

  In the CmsXmlTemplateX I include the following overide to the getCacheDirectives: 

      public CmsCacheDirectives getCacheDirectives(CmsObject cms, 
              String templateFile, String elementName, Hashtable parameters, 
              String templateSelector) { 
          System.out.println("in getCacheDirectives: " + templateFile); 
                  return new CmsCacheDirectives(false); 
      } 

  I'm using the System.out to prove the method is being overidden and to tell me which template is calling it. 

  Assuming the element.cache variable is set to true in the opencms.properties file (due to the error in my last email); when I hit my contact us form from the offline project I get three returns from the System.out: 

  in getCacheDirectives: /system/modules/org.opencms.default/frametemplates/myFrame 
  in getCacheDirectives: /system/modules/org.opencms.default/contenttemplates/myContent 
  in getCacheDirectives: /content/elements/contactUs 

  Which I would expect given the inheritence.  And from this the form works well and sends the emails. 

  When I access this form from the online version, I get no entries from the System out (this is even the case when the element.cache is set to false). 

  Are there any differences with version 5 RC 2?  I've tried returning the CMSCacheDirectives with specific boolean values and I've tried the setNoCacheParameters to the parameter "action" which is set when the form is submitted.  None of this has made a difference. 

  Any help is appreciated. 

  BTW if you missed my last email, the error message produced when I request the contact us form from the offline version when elelment,cache is set to false is: 

  com.opencms.core.CmsException: 0 Unknown exception. Detailed error: A relative path has entered the A_CmsXmlContent class. filename=../frametemplates/secondLevelFrame. 
          at com.opencms.template.A_CmsXmlContent.init(A_CmsXmlContent.java:1031) 
          at com.opencms.template.CmsXmlTemplateFile.<init>(CmsXmlTemplateFile.java:105) 
          at com.opencms.template.CmsXmlTemplate.getOwnTemplateFile(CmsXmlTemplate.java:399) 
          at com.opencms.template.CmsXmlTemplate.getContent(CmsXmlTemplate.java:160) 
          at com.opencms.template.CmsXmlTemplate.templateElement(CmsXmlTemplate.java:1468) 
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
          ...... 


  Regards,
  Aaron



       "Irene Santerini" <i.santerini at inera.it> 
        Sent by: owner-opencms-dev at www.opencms.org 
        25/02/03 19:46 
        Please respond to opencms-dev 
               
                To:        <opencms-dev at www.opencms.org> 
                cc:         
                Subject:        Re: [opencms-dev] contact us form not working in online project 




  Hi Aaron, 
    
    do you have implemented the method "getCacheDirectives"  in your class? 
    
  Irene. 
  ----- Original Message ----- 
  From:  astaffo2 at csc.com.au 
  To: opencms-dev at opencms.com 
  Sent: Tuesday, February 25, 2003 6:25  AM 
  Subject: [opencms-dev] contact us form  not working in online project 


  Hi  all 

  We've implemented a Contact Us  form using the built-in form handling facility of ocms. 

  This form utilises the code example set found in the  user's guide and works perfectly in the offline project. 

  The problem lies in the online project when we publish  this form.  When we access the form, it displays fine, but when submitted  it flicks back to the form as a basic html form would behave.   

  What I'm assuming is that the class isn't  being invoked at this point. 

  Other  custom classes we've created are being called happily in the online project -  all the classes including the contact us class are in a jar file in the  WEB-INF/lib directory. 

  Has anyone  experienced this or have any suggestions? 

  Regards, 
  Aaron 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20030226/265d2609/attachment.htm>


More information about the opencms-dev mailing list