DataTables in the DynaForm - Select a ROW / Zoom?

Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Posts: 5
Joined: Mon Oct 31, 2016 2:08 pm
Country: Brazil

DataTables in the DynaForm - Select a ROW / Zoom?

Unread postby nandoguima » Tue Nov 01, 2016 2:50 pm


I create a Dynaform and the user need choice a field based on another table of DB. First, I use a Dropdown but the user need more information to choose the right option (several columns in this Table) couse the Dropdown only shows a simple column. In fact I need a "Zoom" to user consult and choose o option.

So I found the Panel Option ( Rendering DataTables in the DynaForm ( ... array.html) to user consult data from a this table. Now I need know what the option user choose, to return the field to the main Dynaform.

Am I in the right way (using Datatable) or is there another option to make this "Zoom" ?


Posts: 5992
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: DataTables in the DynaForm - Select a ROW / Zoom?

Unread postby amosbatto » Tue Nov 01, 2016 8:37 pm

It would be easier to use a grid with a checkbox in it to select the row(s). If you want to use DataTables in a panel, then see this:

I imagine, based on that page, that you could create a hidden field in your DynaForm and then set the value of that hidden field when the user submits the DynaForm. For example, you could have a hidden field associated with the "selectedRows" variable in your form. Then use this JavaScript code:

Code: Select all

form = getFormById("637207031573dceaf797e28050874261"); //set to the UID of your form
form.setOnSubmit(function() {
   var aSelectedRows = $('#myDiv').DataTable().rows('.selected').data();
   if (aSelectedRows.length == 0) {
      alert("Please select at least one row");
      return false; //stop submit action
   else {
      var sRows = JSON.stringify(aSelectedRows);

Where "myDiv" is the ID of a DIV you have created in your panel.

Then you can deal with the selectedRows in a subsequent trigger if you need to do anything else:

Code: Select all

$aSelectedRows = json_decode(@@selectedRows)
//to figure out the structure:
//print "<pre>"; var_dump($aSelectedRows); die;
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (

Return to “Developing processes & programming”

Who is online

Users browsing this forum: No registered users and 3 guests