This is very basic stuff, but I cannot seem to get the value of the Form Builder Smarty variable form_id in my UDT.
I have seen a couple of references that use something like
$gCms = cmsms();
$formid = $params['form_id '];
but this is not working for me. (The form field values are accessible through the $params array.)
I also tried accessing it through
$smarty = $gCms->GetSmarty();
$formid = $smarty->get_template_vars('form_id');
again with no luck.
I am sure this is very simple, but I have not yet been able to figure it out and would appreciate some help.
Thanks,
Bob
For Form Builder, how do I get value of form_id in UDT
Re: For Form Builder, how do I get value of form_id in UDT
assuming that {get_template_vars} shows form_id then this should work:
{yourUDT form_id_to_be_parsed=$form_id}
and your UDT processes it with
$formid = $params['form_id_to_be_parsed'];
also:
$smarty = $gCms->GetSmarty();
should be:
$smarty = cmsms()->GetSmarty();
{yourUDT form_id_to_be_parsed=$form_id}
and your UDT processes it with
$formid = $params['form_id_to_be_parsed'];
also:
$smarty = $gCms->GetSmarty();
should be:
$smarty = cmsms()->GetSmarty();
Re: For Form Builder, how do I get value of form_id in UDT
Thanks rotezecke,
Unfortunately, {get_template_vars} does not show form_id directly.
It turns out that it is located in the 'actionparams' Array in get_template_vars. So, you can get it with the following: This was not obvious to me and I thought there must be a more direct way of getting the smarty variables described in the FormBuilder Help.
Unfortunately, {get_template_vars} does not show form_id directly.
It turns out that it is located in the 'actionparams' Array in get_template_vars. So, you can get it with the following:
Code: Select all
$actparams = $smarty->get_template_vars('actionparams');
$form_id = $actparams['form_id'];