Showing posts with label jquery form. Show all posts
Showing posts with label jquery form. Show all posts

Monday, September 24, 2012

jquery form and tinymce

Jquery form doesnt work properly with tinymce,
one way work around is to trigger tinymce input saving before submitting the form


jQuery("#youformid").ajaxForm({
    beforeSerialize: function($form, options) {
      tinyMCE.triggerSave();
    }
});

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.

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...