Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality
Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
#813168
Hi PM Experts,

I don't know if this inquiry has already been raised but I have a situation that I need to show/hide a column grid based on the selected item on the master form. If type of request is [Rent] the column grid [Price per Year] must show. I'm able to do show/hide column grid if the field is part of the grid but when it is dependent on master form I have difficulty implementing it.

Thanks, in advance. :)
Attachments
Evaluation.jpg
Evaluation.jpg (60.98 KiB) Viewed 3822 times
Last edited by as13969 on Wed Feb 21, 2018 8:11 am, edited 1 time in total.
#813206
First of all, have you read this?
http://wiki.processmaker.com/index.php/ ... rid_column

The JavaScript code would be something like this:
Code: Select all
function showOrHideColumn(gridName, fieldName, request) {
   var colNo = getGridField(gridName, 1, fieldName).parentNode.cellIndex;
   rows = document.getElementById(gridName).rows;
   for (i=0; i < rows.length; i ++) {
      if (request == 'Rent') {
         rows[i].cells[colNo].style.display = "";
      } else {
         rows[i].cells[colNo].style.display= "none";
      }
   }
}

//call when DynaForm loads:
showOrHideColumn('productsGrid', 'pricePerYear', getField('typeOfRequest').value); 

getField('typeOfRequest').onchange = function() {
   showOrHideColumn('productsGrid', 'pricePerYear', getField('typeOfRequest').value);
}
Where the name of the grid is "productsGrid", the name of the grid field is "pricePerYear" and the name of the dropdown field is "typeOfRequest" and one of the values in its list of options is "Rent".

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]