Tuesday, August 21, 2012

Zend_Form_Element_File setFilter rename and form->getValues() not working

Take note that form->getValues() will return all values from form, including calling
form file element to receive().
Therefore, setFilter rename shall be called before form->getValues line.

Monday, August 20, 2012

jQuery Form IFrame

When jQuery.form iframe option is assigned to true,
the result of the iframe will be triggered twice if the result contains javascript.

The solution to the problem is to assign [textarea] tag to wrap up the contain.
But having tags within the textarea tag will cause some unexpected result on the contain.
Therefore, php htmlentities shall fix the issue for the tags within the content.

If you are running on Zend, there will be issue.
By default, you may disable the layout and display the action view template.
But due to requirement to wrap the output with textarea,
we shall need to disable the view template, and do a manual output of the view file.

Solution (in controller):
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);

$sView = $this->getViewScript();

if ($this->getRequest()->isPost()) {
   return "[textarea]" . htmlentities($this->view->render($sView)) . "[/textarea]";
} else {
   return $this->view->render($sView);
}


This solution shall output a normal view if its not submitted from the form.

Saturday, August 11, 2012

atomicorp repository and kloxo

Atomicorp supply php5.3 and mod apc required for centos5 version of kloxo.
But the qmail-toaster version supplied by atomic conflict with lxcenter-updates,
therefore, adding
exclude = qmail*
to the /etc/yum.repos.d/atomic.repo

Thursday, August 2, 2012

Setting up Python Mako with MySQL Workbench

It seems that on MAC, does not to include packages from:

/Library/Python/2.7/site-packages/*


Therefore, its not available within the plugin environment of MySQL Workbench.

The solution is to copy
/Library/Python/2.7/site-packages/mako
as:
/Users/james/Library/Application Support/MySQL/Workbench/mako



Wednesday, August 1, 2012

jQuery form and Zend_Form File

It appears that Zend Form will validate fail if we are using ajax or jquery form to submit the form.
To fix the issue, just ensure the form is submitted with the parameter: iframe: true

Also note that IE 8 or below will behave strangely when submitting via jQuery Form with file input.
So avoid using it on IE8 or below...