I want to execute a script only after last entry inserted in gridadd page. Not for every row.
Is any predefined method available to know how many rows having in gridadd page and current row number at the time of submit. (v11)
GridAdd page row count when submit the form
-
- User
- Posts: 111
GridAdd page row count when submit the form
-
- User
- Posts: 11737
Simply use "Row_Inserted" server event to execute a script only after last entry is inserted in Grid-Add page.
If you want to know how many rows in Grid Add page, then simply use "Grid_Inserting" server event:
// Grid Inserting event
function Grid_Inserting() {
// Enter your code here
// To reject grid insert, set return value to FALSE
$rsnew = $this->GetGridFormValues(); // Get the form values of the new records as an array of array
//var_dump($rsnew); die(); // Print the records and end the script
$i = 0;
foreach ($rsnew as $row) { // Loop through the new records
$i++;
}
$this->setSuccessMessage($i); // <-- you will know how many rows in the grid here
return FALSE; // <-- this is only for check, just remove this line to proceed
return TRUE;
}
-
- User
- Posts: 111
function Grid_Inserting() {
$rsnew = $this->GetGridFormValues();
var_dump($rsnew);
return FALSE;
}
I have filled two rows, but var_dump($rsnew) Is giving empty values as below.
array (size=2)
0 =>
array (size=7)
'SLNO' => &null
'EMPNO' => &string '' (length=0)
'EMP_NAME' => &string '' (length=0)
'PERMISSION' => &string '' (length=0)
'DEPT' => &string '' (length=0)
'RIGHTS' => &string '' (length=0)
'CURRENTTIME' => &null
1 =>
array (size=7)
'SLNO' => &null
'EMPNO' => &string '' (length=0)
'EMP_NAME' => &string '' (length=0)
'PERMISSION' => &string '' (length=0)
'DEPT' => &string '' (length=0)
'RIGHTS' => &string '' (length=0)
'CURRENTTIME' => &null
How to get form values in Grid_Inserting() event.