magento - set values in form fields in edit mode when data comes from multipal tables -


i developing custom module project. created custom form , custom form's data saved in 2 tables. when form open in edit mode not able saved data both tables. have no idea how can resolve issue, please me.

here 2 tables structures:

table1-

------------------------- id | page_id | title  1  |  3      |  abc  2  | 4       |  pqrs  3  | 10      |  xyz 

table2-

-------------------------------- id | page_id | child  | position  1  | 3       |  8     |  left  2  | 3       |  7     |  right  3  | 3       |  15    |  right  4  | 4       |  14    |  right  5  | 4       |  15    |  left  6  | 10      |  15    |  left  -------------------------------- 

here attaching screen-shot more explain myself. want selected saved option values in 'left' & 'right' text-area in edit mode, values comes table2.

form fields

please suggest me. in advance.

left , right here multiselect field types , these kind of fields receives values in comma separated string. example presented work in way. lets consider have models table1 , table2 , pass table model edit action in controller have written

$table1id = $this->getrequest()->getparam('id'); $table1model  = mage::getmodel('page/table1')->load($table1id); if ($table1model->getid()) {          mage::register('page_data', $table1model); ... 

in form file block/adminhtml/edit/tab/form.php there method $form->setdata()

if ( mage::getsingleton('adminhtml/session')->getpagedata() )     {         $form->setvalues(mage::getsingleton('adminhtml/session')->getpagedata());         mage::getsingleton('adminhtml/session')->setpagedata(null);     }  elseif ( mage::registry('page_data') ) { $values = mage::registry('page_data')->getdata(); $values['left'] = '8';//you can value table2 collection on basis of $values['page_id'] got $values['right'] = '7,15';////you can value table2 collection on basis of $values['page_id'] got         $form->setvalues($values);     } 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -