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

Moderator: amosbatto

#787268
Hi!

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 (http://wiki.processmaker.com/3.0/Panel_Control) Rendering DataTables in the DynaForm (https://www.datatables.net/examples/dat ... 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" ?

regards
#787273
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:
https://datatables.net/examples/api/select_row.html

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);
      $("#selectedRows").setValue(sRows);
  }
});
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;

Per https://wiki.processmaker.com/3.2/Suggest_Cont[…]

Is there a way to set the calendar pick list for v[…]

I'm trying to capture the time and date a user tak[…]

how to skip this stages

I re-read the thread and I have moved any Before A[…]