You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by mp...@apache.org on 2004/04/09 18:25:18 UTC

cvs commit: cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/transformation FormsPipelineConfig.java

mpo         2004/04/09 09:25:18

  Modified:    src/blocks/forms/java/org/apache/cocoon/forms/transformation
                        FormsPipelineConfig.java
  Log:
  Allow the form-method to be null rather then default it to POST.
  This allows for forms transformer and generator to have different default 
  expectations about this form-method.
  (the generator expects POST, the transformer should follow the HTML default GET)
  
  Revision  Changes    Path
  1.4       +16 -4     cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java
  
  Index: FormsPipelineConfig.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FormsPipelineConfig.java	18 Mar 2004 21:04:39 -0000	1.3
  +++ FormsPipelineConfig.java	9 Apr 2004 16:25:18 -0000	1.4
  @@ -115,7 +115,7 @@
   
           String attributeName = parameters.getParameter("attribute-name", null);
           String actionExpression = parameters.getParameter("form-action", null);
  -        String formMethod = parameters.getParameter("form-method", "POST");
  +        String formMethod = parameters.getParameter("form-method", null);
           //TODO (20031223 mpo)think about adding form-encoding for the Generator.
           // Note generator will also need some text to go on the submit-button? 
           // Alternative to adding more here is to apply xinclude ?
  @@ -275,11 +275,21 @@
        * Note: wi:form-template copies this from its wt:form-template counterpart.
        * 
        * @return the value of the 'form-method' sitemap parameter to the pipeline 
  -     * component. Defaults to 'POST' if it was not set.
  +     * component. (or 'null' if it was not set.)
        */
       public String getFormMethod() {
           return formMethod;
       }
  +    
  +    
  +    /**
  +     * Sets the form method to use in the generator/transformer that uses this.
  +     * 
  +     * @param method to use in the generated form should be "POST", "GET" or null
  +     */
  +    public void setFormMethod(String method) {
  +        this.formMethod = method;
  +    }
   
       /**
        * The grouped attributes to set on the wi:form-generated element.
  @@ -293,7 +303,9 @@
           if (getFormAction() != null) {
               formAtts.addCDATAAttribute("action", getFormAction());
           }
  -        formAtts.addCDATAAttribute("method", getFormMethod());
  +        if (getFormMethod() != null){
  +            formAtts.addCDATAAttribute("method", getFormMethod());
  +        }
           return formAtts;
       }
   }