Live inputs - option type L

All the inputs can be used as live inputs where after changing can update the database values automatically withou having to sava changes. WARNING: these changes are not reversible.

When using live inputs we need to have the following option types on our section: L ,

Or we can manually adding them by setting the option types live, form and update to true and including the following JS library:


<!-- Live edit functions -->
<script type="text/javascript" src="/kas/js/live_edit.js?v=1606744636"></script>

<?php
   $options['add'] = false;  //make sure add is off in case there is an add form above the live inputs
   $options['live'] = true;
   $options['form'] = true;
   $options['update'] = true;
   $options['live'] = true;
?>

 

Live inputs generate an encrypted data containing the table name, column name and id value of the record to be changed. Most of the times we already have those variables in use:

 

$dbtable = 'TABLE_NAME';
$idfield = 'COLUMN_NAME';
// $idvalue generated automatically when the URL has an ID 

 

if we don't have those variables set, we can pass them to the live input with the 'encdata' value.

 

'encdata'=>[
   'TYPE'    =>'LIVE',  //optinal, LIVE is by default and required for LIVE inputs
   'DBTABLE' =>$dbtable,
   'IDFIELD' =>$idfield,
   'IDVALUE' =>$idvalue
]

 

There are many types of LIVE inputs: text, email, tel, url, textarea, select, colorPicker, switch, search, DropZone, etc.

To set the type of LIVE input we use the inputType value:

 

addField([
   'type'=>'live',  //required
   'inputType' =>'text', //required
   'label'=>'Article Title', //required
   'name' => 'title_en', //required (column name)
   'attributes'=>'readonly', //optional empty by default
   'value' => '' //optional, it can be left empty or add the value from the database
   'ID'=>'title_live', //optional, name is used by default
   'placeholder'=> '', //optional, empty by default and not used by all the inputTypes
   'encdata'=>[  //optional unless $dbtable, $idfield and $idvalue are not declared, 
      'TYPE'    =>'LIVE',
      'DBTABLE' =>$dbtable,
      'IDFIELD' =>$idfield,
      'IDVALUE' =>$idvalue
   ]
]);
 
 
Each inputType has a different options and values, look at the documentation provided for each one of them in the Form Views documentation
 
Get a Quote

Get a Quote