For Form Builder, how do I get value of form_id in UDT

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
RHF
Forum Members
Forum Members
Posts: 20
Joined: Sun Jan 23, 2011 1:55 am

For Form Builder, how do I get value of form_id in UDT

Post by RHF »

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
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: For Form Builder, how do I get value of form_id in UDT

Post by rotezecke »

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();
RHF
Forum Members
Forum Members
Posts: 20
Joined: Sun Jan 23, 2011 1:55 am

Re: For Form Builder, how do I get value of form_id in UDT

Post by RHF »

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:

Code: Select all

$actparams = $smarty->get_template_vars('actionparams');
$form_id = $actparams['form_id'];
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.
Post Reply

Return to “Modules/Add-Ons”