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

Moderators: ArturoRobles, ArturoRobles

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By marc795
#794023
Hallo,

I have a array called Material in a dynaform. Now i wann to multiply 2 text fields columns with name price and piece. In the third column should shown the product. How can i Do this
By stevensi1018
#794024
Let's put 'Material' as the ID of your array (type grid in Dynaform)

Access your grid: $("#Material").getValue(1,1) will return the value of the first line and first column... in general: getValue(row,column)
You add that to your Javascript code in the dynaform (click on the form border and then on the left side there is a 'edit' button next to Javascript:
Code: Select all
var price = $("#Material").getValue(1,1); //first column is the price
var piece = $("#Material").getValue(1,2); //second column is the number of pieces i guess
var product = price * piece;
$("#Material").setValue(product,1,3) //third column would be the product
Hope that helps :)
By marc795
#794026
Thank you. I will try it but the grid is dynamic. If i add a new row in the dynaform i must edit the code. Can i make the code dynamic too or with a variable for the row?
By stevensi1018
#794048
marc795 wrote:Thank you. I will try it but the grid is dynamic. If i add a new row in the dynaform i must edit the code. Can i make the code dynamic too or with a variable for the row?
Use the function onAddRow() : http://wiki.processmaker.com/3.0/JavaSc ... d.onAddRow (use the same parameters as the examples) onAddRow(function(aNewRow, oGrid, rowIndex) and you can do something like $("#Material").getValue(rowIndex,1) to make it dynamic for each line added
REST API Question

I am currently looking at developing a portlet for[…]

Everybody wants to be famous, but nobody wants to […]

Hi, I attached a sample config file, Please check […]

Error clicking on Participated

Hi, I attached a sample config file, Please check […]