3

The View

<?php echo $this->Form->create('Practice');
echo $this->Form->input('title',array('value'=>'test value'));
echo $this->Js->submit('Ajax Submit', array(
'update' => '#left',
 'url'=>'/practices/content',
 'async' => true,
 'method' => 'post',
 'dataExpression'=>true,
 'data'=> $this->Js->serializeForm(array(
     'isForm' => true,
     'inline' => true 

  ))
    ));
?> <?php echo $this->Form->end(); ?>

the form works fine before the Ajax submit. the ajax submit actually return a new form field of the same model. below is the view of which the form is being sent firstly for ajax

echo $this->Form->input('Practice.options',array('value'=>'regex value'));

the new field value is not being submit with the form

1
  • form end tag is there but still no change in solution Commented Sep 18, 2013 at 14:48

2 Answers 2

2

I was doing two mistakes first the new ajax returned fields were not inside form tag second I needed to bypass the cakephp security check

function beforeFilter() {
        parent::beforeFilter();
        $this->Security->blackHoleCallback = 'blackhole';
        $this->Security->csrfCheck = false;
        $this->Security->validatePost = false;
        $this->set('contentLayout', 'admin_dashboard');
    }
Sign up to request clarification or add additional context in comments.

Comments

0

Make sure that your put at the end of your form

<?php echo $this->Form->end(); ?>

and you unlock the current action for the SecurityComponent

1 Comment

I have counter checked that the end tag is there

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.