Formbuilder Save Checkbox Group to LISE Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
webform
Power Poster
Power Poster
Posts: 505
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Formbuilder Save Checkbox Group to LISE

Post by webform »

I have a FormBuilder form with a Checkbox group, which constitutes a Module Interface Field from a LISE Instance (LISEEquipment).

My FormBuilder form saves to another LISE Instance (LISEEmployee) where the field is set to be a LISE Instance Item (LISEEquipment) with item_id as Identifier and Sub Type is set to Chekcbox Group.

In the backend in the Item overview, I can see the selected values correctly, but when I click on the individual item, nothing is selected in the checkbox group.

So how do I get the individual checkboxes to be selected in the LISE Instance when creating from FormBuilder?

I can see in the MySQL table that the checkbox group values are stored as comma separated values in a record e.g. 5, 8, but if I select the checkbox group directly in my LISE Instance, 5 and 8 are stored in the MySQL table as individual records.
I assume that it is my UDT saving from FormBuilder that is the problem?

The part of the UDT that is saving to LISE:

Code: Select all

$obj->title = $params['title'];
$obj->alias = $alias; # we already have one
$obj->url = $url_prefix . '/' . $params['recid'] . '-' . preg_replace('/-+/', '-', $title);

foreach($params as $key => $value) {
  if(isset($obj->fielddefs[$key])){
    if($value != "[unspecified]"){
      $obj->$key = $value;
    }
  }
}

$mod->SaveItem($obj);
WDJames
Forum Members
Forum Members
Posts: 81
Joined: Tue Feb 13, 2018 1:09 pm

Re: Formbuilder Save Checkbox Group to LISE

Post by WDJames »

Hi,

This is my part of my UDT if I want to save checkboxes:

Code: Select all

foreach($params as $key => $value) {
   if(isset($obj->fielddefs[$key])){
      if($value != "[unspecified]"){
         if($key == "checkboxes"){
           $multi_result = explode(",", $params["checkboxes"]);
           $obj->checkboxes = $multi_result;
         }else {
           $obj->$key = $value;
         }
      }
   }
}
Replace "checkboxes" with the alias of your LISE field.

I hope this helps.

Thanks,

James
User avatar
webform
Power Poster
Power Poster
Posts: 505
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: Formbuilder Save Checkbox Group to LISE

Post by webform »

Ahh! Thats very cool!

I'll try that. Thanks!
Post Reply

Return to “Modules/Add-Ons”