CMS Made Simple Forums

CGBetterForms and LISE
Page 1 of 1

Author:  WDJames [ Thu Apr 25, 2019 11:17 am ]
Post subject:  CGBetterForms and LISE

Hi all,

I've recently started using CGBetterForms as a replacement for FormBuilder.

With FormBuilder I was able to take the form data and insert it to LISE via a UDT.

I've tried to follow the help page from CGBetterForms and used the "Stop processing dispositions based on a condition" disposition and within that template called my UDT.

I can confirm that the UDT is being triggered but I need a way of getting the form submission values into the UDT. For my test, I'm using the Sample contact form with the following fields: name, email, comments.

Below is my UDT:

$mod = cmsms()->GetModuleInstance('LISEContactFormDatabase');

$obj = $mod->InitiateItem();

$obj->title = $name;


The code above submits the form but the "$name" variable is blank and no LISE item is created.

Any ideas would be greatly appreciated.



Author:  velden [ Thu Apr 25, 2019 1:26 pm ]
Post subject:  Re: CGBetterForms and LISE

A working example (shortened):

Note I use some GUID (cgbf_requestid) generated by CGBF as an alias. Works for my case, but may be you need something different.

{UDTNameHere formdata=$response}

$d = $params['formdata'];

$mod = \cms_utils::get_module('LISEExample');

$item = $mod->LoadItemByIdentifier('alias', $d->get_field_value('cgbf_requestid'));

$item->email = $d->get_field_value('kfrm_p_inp_email');
$item->thema = $d->get_field_value('kfrm_inp_theme');
$item->datum = strftime('%Y-%m-%d',$d->get_field_value('kfrm_inp_date'));


Author:  WDJames [ Thu Apr 25, 2019 2:18 pm ]
Post subject:  Re: CGBetterForms and LISE

Hi Velden,

Thanks for the reply and for providing an example. I was able to make it work with my code by taking some things from your example. Below is what I ended up with:


{savecontactformdata formdata=$response}


$d= $params['formdata'];

$mod = cmsms()->GetModuleInstance('LISEContactFormDatabase');

$obj = $mod->InitiateItem();

$obj->title = $d->get_field_value('name');
$obj->email = $d->get_field_value('email');
$obj->comments = $d->get_field_value('comments');


If I'm being cheeky, I'd like to expand on this code by adding a foreach loop that cycles through the LISE fields and insert data from the equivalent inputs so that each field doesn't need to written separately.

Thanks for your help.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group