Friday, July 12, 2013

Submitting FormHelper forms in Internet Explorer 8

I have a Cake 2.2.8 application with a whole collection of forms. All work perfectly in IE9/Chrome/usual suspects.

When submitting a form in IE8, it doesn't work, just reloads the page.

The add method for the controller method code is fairly basic;

    public function add() {
        // KB added for test
    debug($_REQUEST);
    debug($this->request);
    debug($_POST);
debug($_SERVER);
   
        if( $this->request->is('post') ) {
            $this->request->data['User']['created_by'] = $this->Auth->user('id');

            if($this->Auth->user('group_id') == 2) {
                $this->User->addAdditionalValidationRulesForStaff();
            }

            $this->User->create();
            if( $this->User->save($this->request->data) ) {
                $this->flashSuccess(__('The user has been saved'));
                $this->redirect(array('action' => 'index'));
            } else {
                $this->flashFailure(__('The user could not be saved. Please, try again.'));
            }
        }

        $this->_setLists();
    }

Again, it works fine in all browsers except IE 8. The output of debug($_SERVER); shows 'REQUEST_METHOD' => 'GET', in IE8, whilst other browsers show 'REQUEST_METHOD' => 'POST'
debug($_POST) is empty in IE 8 and is populated in other browsers.

The form view code is quite basic too

<?php echo $this->Form->create('User'); ?>
...
<?php echo $this->Form->Submit(ucwords($this->params["action"]).' '.ucwords(Inflector::singularize($this->params["controller"])),array('div' => false, 'class' => 'btn btn-info')); ?>
<?php echo $this->Form->end(); ?>

Incidentally the identical "Edit" method works fine.
Other controllers are also affected by this issue.

Has anyone else experienced this issue? Or know how to fix it?

Thanks

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: