php - Cakephp Form is not getting submiited but giving Notice (8): Array to string Coversion, many other Warnings (2) -
i having trouble submitting/saving data cakephp model. constructed form usual do, time getting notices , warning data not getting saved. here form have constructed , method in controller:
educationaldetails.ctp
<?php if (empty($education)): echo $this->form->create('candidate', array('class' => 'dynamic_field_form')); echo $this->form->input('candidateseducation.0.candidate_id', array( 'type' => 'hidden', 'value' => $userid )); echo $this->form->input('candidateseducation.0.grade_level', array( 'options' => array( 'basic' => 'basic', 'masters' => 'masters', 'doctorate' => 'doctorate', 'certificate' => 'certificate' ) )); echo $this->form->input('candidateseducation.0.course'); echo $this->form->input('candidateseducation.0.specialization'); echo $this->form->input('candidateseducation.0.university'); echo $this->form->input('candidateseducation.0.year_started', array( 'type' => 'year' )); echo $this->form->input('candidateseducation.0.year_completed', array( 'type' => 'year' )); echo $this->form->input('candidateseducation.0.type', array( 'options' => array( 'full' => 'full', 'part-time' => 'part-time', 'correspondence' => 'correspondence' ))); echo $this->form->input('candidateseducation.0.created_on', array( 'type' => 'hidden', 'value' => date('y-m-d h:i:s') )); echo $this->form->input('candidateseducation.0.created_ip', array( 'type' => 'hidden', 'value' => $clientip )); echo $this->form->button('submit', array('type' => 'submit', 'class' => 'submit_button')); echo $this->form->end(); endif;
candidatescontroller.php
public function educationaldetails() { $this->layout = 'front_common'; $this->loadmodel('candidateseducation'); $education = $this->candidateseducation->find('first', array( 'conditions' => array( 'candidate_id = ' => $this->auth->user('id') ) )); $this->set('education', $education); // checking if in case candidates education available polpulate form if (!empty($education)): // if form empty populating form respective data. if (empty($this->request->data)): $this->request->data = $education; endif; endif; if ($this->request->is(array('post', 'put')) && !empty($this->request->data)): $this->candidate->id = $this->auth->user('id'); if ($this->candidate->saveassociated($this->request->data)): $this->session->setflash('you educational details has been updated', array( 'class' => 'success' )); return $this->redirect(array( 'controller' => 'candidates', 'action' => 'jbseeker_myprofile', $this->auth->user('id') )); else: $this->session->setflash('you personal details has not been ' . 'updated successfully, please try again later!!', array( 'class' => 'failure' )); endif; endif; }
here screenshot of errors getting, not able figure out happening while other forms working correctly. looks something wrong view?
this error coming out because not passing proper arguments session->setflash()
method, doing this:
$this->session->setflash('you personal details has not been updated successfully, please try again later!!', array( 'class' => 'failure' ));
in docs mentioned like:
$this->session->setflash('you personal details has not been updated successfully, please try again later!!', 'default', array( 'class' => 'failure' ));
Comments
Post a Comment