• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: CGBetterForms and LISE
PostPosted: Thu Apr 25, 2019 11:17 am 
Offline
New Member
New Member

Joined: Tue Feb 13, 2018 1:09 pm
Posts: 6
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:

\$1:
$mod = cmsms()->GetModuleInstance('LISEContactFormDatabase');
if(!is_object($mod))
return;

$obj = $mod->InitiateItem();

$obj->title = $name;

$mod->SaveItem($obj);


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

Any ideas would be greatly appreciated.

Thanks,

James


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBetterForms and LISE
PostPosted: Thu Apr 25, 2019 1:26 pm 
Online
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3121
Location: The Netherlands
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.

\$1:
{UDTNameHere formdata=$response}


\$1:
$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'));

$mod->SaveItem($item);


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBetterForms and LISE
PostPosted: Thu Apr 25, 2019 2:18 pm 
Offline
New Member
New Member

Joined: Tue Feb 13, 2018 1:09 pm
Posts: 6
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:

UDT:

\$1:
{savecontactformdata formdata=$response}


Code:

\$1:
$d= $params['formdata'];

$mod = cmsms()->GetModuleInstance('LISEContactFormDatabase');
if(!is_object($mod))
return;

$obj = $mod->InitiateItem();

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

     
$mod->SaveItem($obj);


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.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: googlebot


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting