Hey guys, I've got a problem with a form. I created function which make a form in foreach loop, code is below:
Function
function genForm($iId) {
$aForm = array(
'form_attrs' =>array(
'name' => 'add_friend_to_event',
'action' => '',
'method' => 'post',
),
'params' => array (
'db' => array(
'table' => 'events_users',
'key' => 'id',
'submit_name' => 'submit_form',
),
),
'inputs' => array(
'nickname' => array(
'type' => 'text',
'name' => 'id_participant',
'db' => array(
'pass' => 'text'
),
),
'id_event' => array(
'type' => 'text',
'name' => 'id_event',
'value' => $iId,
),
'submit' => array(
'type' => 'submit',
'name' => 'submit_form',
'value' => _t('_Submit'),
'colspan' => true,
)
)
);
$oForm = new BxTemplFormView($aForm);
$oForm->initChecker();
$echo = $oForm->getCode();
return $echo;
}
And here is a loop;
foreach ($aEvents as $sKey => $aRow) {
$iId = $aEvents[$sKey]['Id'] = $aRow['Id'];
$form['code'] = $this->genForm($iId);
var_dump ($form);