Hi all,
Since version 1.5 of Joomla, things have improved to deal with form data, and it really is amazing what the JForm does. However, I need a help on how to do it to load data from a different ID pointed to by the $ _GET / $ _POST for cases in which I am not using just one form, i.e, where there is a relationship between the main table and related tables.
/admin/helloworld/tmpl/edit.txt,added:
<?php foreach($this->formCustom->getFieldset('details') as $field): ?>
<li><?php echo $field->label;echo $field->input;?></li>
<?php endforeach; ?>
/admin/helloworld/view.html.php, in display():
$form = $this->get('FormCustom');
$this->formCustom = $form;
/admin/models/helloworld.php, new method
public function getFormCustom($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_helloworld.custom', 'custom', array('control' => 'jformCustom', 'load_data' => $loadData));
return $form;
}
/admin/models/forms, new file
custom.xml
It works fine for print adicional forms on same view and make form names as jformCustom['fieldname'], and and manages well when fields have the same names of multiple forms when save it. But... the problem is thatI do not know how to override id which will be used to load data, and will load JForm will load same id. I see that I can chose which data will load editing loadFormData() from model, but... how to do it? Also, how to get last some field from last call and use on next loadFormData() and avoid overhead from another querie to database?
--
Emerson da Rocha Luiz
+55 51 9881-9146 | MSN: emerson at webdesign.eng.br | GTalk: fititnt at Gmail | Skype: fititnt | http://www.fititnt.org | Twitter: @fititnt