I want to build a form, it allows user input one or more item(name, amount, price, note, ...) and click to save.
$theme = $this->pack_module('Base/Theme');
$form = $this->init_module('Libs/QuickForm');
$details = array();
for($i = 0; $i < 30; $i++)
{
$row = array();
$row[]=$form->createElement('text', 'name', __('Name'));
$row[]=$form->createElement('checkbox', 'amount', __('Name'));
$details[] = $form->addGroup($row, $i, 'Item');
}
$form->addGroup($details, 'materials', 'Materials');
$submit = $form->addElement('submit', 'submit_button', 'Add', array('onclick'=>'leightbox_deactivate("'.$prompt_id.'");'.$prompt_id.'_submit_form();'));
$form->assign_theme('form',$theme);
ob_start();
$theme->display();
$profiles_out = ob_get_clean();
<table id="Material" style="width: 100%;">
{foreach from=$form_data item=f}
{if is_array($f) && isset($f.type) && $f.name != 'money_amount' && $f.type!='hidden' && $f.type!='button' && $f.type!='submit'}
<tr>
<td class="epesi_label">
{$f.name}
</td>
<td class="epesi_data" style="width:15%;">
{$f.html}
</td>
</tr>
{/if}
{/foreach}
</table>