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

Moderator: 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.
i want Fix the grid to 31 rows and add the second columns
with this code but it not work :?: and i do not know why??? plz help
for (i=0; i < 30; i++) {


var row1= $("#gridVar001").getNumberRows();
var col_grid1 = 0;
var total_grid1 = 0;

var row2= $("#gridVar002").getNumberRows();
var col_grid2 = 0;
var total_grid2 = 0;

var total = 0;

for(var i=1;i<=row1;i++){

col_grid1 = parseInt($("#gridVar001").getValue(i,5));
total_grid1 += col_grid1;


for(var j=1;j<=row2;j++){

col_grid2 = parseInt($("#gridVar002").getValue(j,5));
total_grid2 += col_grid2;


total = total_grid1 + total_grid2;

Hi there,

1/ First you can't use mouseover function, see link for form's functions supported:

Use $("#60812377960ff8494201cb7011756346").setOnchange(function (field, newValue, oldValue){
// calculate your total here...

2/ make use the property of 'function', say at Grid 1 & Grid 2's column 2,
Dynaform > properties > function > select SUM (for grid column 2)

it will provide you a column summation, so you don't need to have a FOR loop to calculate by yourself.
Example codes are in below FYI:
Code: Select all
for (var i=0; i < 30; i++) {

$("#60812377960ff8494201cb7011756346").setOnchange(function(field, newValue, oldValue){
      //something like..
     var total_grid1 = parseFloat($("#gridVar001").getSummary("column2_id"));
     var total_grid2 = parseFloat($("#gridVar002").getSummary("column2_id"));
      var total = total_grid1 + total_grid2;

How to change login labels

Hi, You can go to Admin->Settings->Language […]

Hide / Show based on selection

Hi, I have write a function for show and hide fi[…]

It happens no matter what version of moodle I use.[…]

Thank you kirkwg for your response. I will try thi[…]