symfony1 - How to get the value of a textarea in Symfony -


i can't seem inputted text of textarea. when :

die($request->getpostparameter('comment'))  

it outputs word "array". when print_r() show textarea array , value stored in array. don't know how value can put field in table.

@greg0ire: doing because trying save data 2 different tables. html page displays form made of 2 forms 2 different classes/models. have managed save fields both tables except comment field. tried getting value , realising array, wondered if causing data not save. why asking question. have asked question explains context.

these functions run on clicking submit button

   public function executeupdateinlineform(sfwebrequest $request) {    $overdueinvestigation = doctrine_core::gettable('investigation')->find( $request->getparameter('id'));      $investigationform = new investigationinlineform($overdueinvestigation);     $commentform=new commentform();       $investigationform->bind($request->getparameter($investigationform->getname()), $request->getfiles($investigationform->getname()));     $commentform->bind($request->getparameter($commentform->getname()), $request->getfiles($commentform->getname()));      $this->processinlineform($investigationform, $commentform);    }  protected function processinlineform(sfform $investigationform, sfform $commentform) {     if ($investigationform->isvalid())       {          $investigation = $investigationform->save();             $comment = $commentform->updateobject();          $comment->setinvestigation_id($investigationform->getobject()->getid());          $comment->setcomment($commentform->getobject()->getcomment());          $comment->setuserid($investigationform->getobject()->getcreateduserid());          $comment->setdateentered(time());          $comment->save();          $this->redirect('investigation/overdue/');      }   } 

you store $request->getpostparameter('comment') in array , use array_pop() on array, think better understand why you're getting array. think name of textarea must comment[], when should comment.

update

after reading update , other question seems need have naming convention fields:

<input type="text" name="investigation[field1]"/> <input type="text" name="investigation[field2]"/> <input type="text" name="investigation[field3]"/> <input type="text" name="comment[content]"/> 

use setnameformat() method on widget schema of forms achieve this, bind investigation form investigation request parameter, , comment form comment parameter , fine.

good luck!


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -