title: Overwriting JControllerForm save() Method to Trim POST Data Has No Effect
body: <p>I have a component that has a controller called <code>MyproductControllerGeneralsetting</code> which extends <code>JControllerForm</code>. Inside <code>MyproductControllerGeneralsetting</code> I am overwriting the <code>save</code> method from the parent class in order to modify <code>$_POST</code> data and then the overwriting method calls the parent class' <code>save</code> method to do the actual saving.</p>
  
  <p>Here's the overwritten method in <code>MyproductControllerGeneralsetting</code>:</p>
  
  <pre><code>/**
   * We overwrite the saved form data and trim them to avoid spaces
   */
  public function save($key = null, $urlVar = null){
      if($_POST['jform']){
          foreach($_POST['jform'] as $key=&gt;&amp;$value){
              $value = trim($value);
          }
      }
  
      // Finally, save the processed form data (calls JControllerForm-save())
      parent::save('id', $urlVar);
  }
  </code></pre>
  
  <p>The thing is that even though I've trimmed each POST data field in this overwriting method, if I have some values submitted such as 'value ' (note the space in the end), they are not trimmed.</p>
  
  <p>I've checked the <code>save</code> method of the <code>JControllerForm</code> class and it seems to be getting the data from POST here:</p>
  
  <pre><code>$data  = $this-&gt;input-&gt;post-&gt;get('jform', array(), 'array');
  </code></pre>
  
  <p>Maybe that's the reason? Is this getting cached data or something?</p>