I am creating a form via module, that I wish to use for both insert and update. After the insert user has the option of going back to edit the values previously input. The issue that I encounter is with the update.
This function decides if insert or update
public function form()
{
session_start();
$tagdata = $this->EE->TMPL->tagdata;
if(isset($_SESSION['id'])){
$variables = array();
$variables[] = $_SESSION['tags'];
return self::buildForm('updateForm', $tagdata, $variables);
}
return self::buildForm('addDonation', $tagdata);
}
While this function handles the actual building of the form
public function buildForm($method, $tagdata, $variables = FALSE)
{
$hidden_fields = array(
'ACT' => $this->EE->functions->fetch_action_id('Meal', $method)
);
if($variables != FALSE){
$conditionals = $this->EE->TMPL->simple_conditionals($tagdata, $variables);
$conditionals = $this->EE->TMPL->parse_variables_row($conditionals, $variables);
print_r($conditionals);
$content = $this->EE->TMPL->parse_globals($this->EE->TMPL->final_template);
}
//Build an array with the form data
$form_data = array(
"id" => $this->EE->TMPL->form_id,
"class" => $this->EE->TMPL->form_class,
'hidden_fields' => $hidden_fields
);
$form = $this->EE->functions->form_declaration($form_data) . $content . "</form>";
return $form;
}
The output is currently {if FirstName !=
and {FirstName} within the conditional is not being parsed.
Any help greatly appreciated!