Gridedit is not saving selected data into record

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
bobmulder5555
User
Posts: 60

Gridedit is not saving selected data into record

Post by bobmulder5555 »

I have a setup where the user will change a field in a table by doing a search, selecting the right person (it displays in the field) and clicking the update button.
But rsnew contains a NULL value for the changed field.
I'm thinking maybe I need to do something with client side scripts, but that is not my cup of tea. Should it be working as expected or do I need to transfer the viewvalue to the server somehow..?

Any help would be greatly appreciated.


sangnandar
User
Posts: 980

Post by sangnandar »

bobmulder5555 wrote:
I have a setup where the user will change a field in a table by doing a search, selecting
the right person (it displays in the field) and clicking the update button.

What is this? Is it modal dialog lookup? Is it text edit tag with lookup and allow sort/search enabled?

But rsnew contains a NULL value for the changed field.

How do you know that rsnew is NULL on that field?


bobmulder5555
User
Posts: 60

Post by bobmulder5555 »

Yes, both:
The Edit Tag has Use Modal Dialog for Lookup, I haven't allowed sort/search (no reason)
The Table itself is sorted, and in search I have enabled Extended, Advanced & Modal Dialog
[I totally don't know if I'm doing something not-so-smart-here; I don't know the finesses of 2018 yet]

NULL: because I'm writing another record with the results, so I Vardumped when things didn't go as expected.


bobmulder5555
User
Posts: 60

Post by bobmulder5555 »

Update: the table is being sorted & filtered in Table options and it's in Gridedit


bobmulder5555
User
Posts: 60

Post by bobmulder5555 »

The code, I'll get the Vardump as well

// Row Updating event
function Row_Updating($rsold, &$rsnew) {
// Enter your code here
// To cancel, set return value to FALSE

//30/11/17 - in view vw3_change_roster a new doctor has been selected

//The new key needs to be swapped to the right place, and we can put the old key in the change coloumn, but not nec
//because we write a separate ShiftChange Rec for the financial clearing

//swap-keys
$arts_wordt = $rsnew["RI_ZVL_ID_NEW"];
$arts_was = $rsold["RI_ZVL_ID"];
$rsnew["RI_ZVL_ID_NEW"]=$arts_was;
$rsnew["RI_ZVL_ID"]=$arts_wordt;

//testing purposes
$sarts = &$this->RI_ZVL_ID_NEW->CurrentValue;
echo "sarts= ".$sarts;
$dart="";
if(isset($GET['RI_ZVL_ID_NEW']) && trim($GET['RI_ZVL_ID_NEW'])!='')
{
$dart = $_GET['RI_ZVL_ID_NEW'];

}
echo "dart= ".dart;
//end testing

//write mutrecord tbl3_dr_dienstruil
$DR_RI_ID = $rsold["RI_ID"];
$DR_FULLDATE = $rsnew["RI_FullDateYYYYMMDD"];
$DR_Dienst_ID = $rsnew["RI_Dienst_ID"];
$DR_Date_Ruil = ew_CurrentDate();
$CT = ew_CurrentTime();
$CU = CurrentUserID();
$DUMMY="";
$MyResult = ew_Execute("INSERT INTO tbl3_dr_dienstruil(DR_RI_ID, DR_Dienst_ID, DR_ZVL_ID_New, DR_ZVL_ID_Old, DR_Opmerking, DR_Date_Ruil, DR_TIME_Ruil, DR_RUILER_USERID, DR_FULLDATE) VALUES ('$DR_RI_ID', '$DR_Dienst_ID', '$arts_wordt', '$arts_was', '$DUMMY', '$DR_Date_Ruil', '$CT', '$CU', '$DR_FULLDATE')");

//Vardump
echo "<pre>";
echo "Row_Updating";
var_dump($MyResult);
var_dump(get_defined_vars());
echo "</pre>";

return TRUE;

}


mobhar
User
Posts: 11660

Post by mobhar »

Since you use "Grid-Edit" mode, then you should use "Grid_Updated" server event. This should help you to start: hkvforums.com/viewtopic.php?f=18&t=41434


bobmulder5555
User
Posts: 60

Post by bobmulder5555 »

And the Vardump. RI_ZVL_ID_NEW is NULL but that's OK, because nothing was there before the ShiftSwap. But after, I swap the keys and you can see that RI_ZVL_ID gets NULL swapped into it, while it should be set to the new doctors key.

sarts= dart=

Row_Updating

G:\wamp64\www\sszkmm\vw3_wijzig_roosterinfo.php:1375:
object(ADORecordSet_empty)[134]
public 'fields' => boolean false
public 'EOF' => boolean true

G:\wamp64\www\sszkmm\vw3_wijzig_roosterinfo.php:1376:
array (size=14)
'rsold' =>
array (size=18)
0 => string '25046' (length=5)
'RI_ID' => string '25046' (length=5)
1 => string '5' (length=1)
'RI_ROS_ID' => string '5' (length=1)
2 => string '2018-06-09' (length=10)
'RI_FullDateYYYYMMDD' => string '2018-06-09' (length=10)
3 => string '18' (length=2)
'RI_Dienst_ID' => string '18' (length=2)
4 => string '151' (length=3)
'RI_ZVL_ID' => string '151' (length=3)
5 => string 'ZUID' (length=4)
'RI_locatie' => string 'ZUID' (length=4)
6 => string '151' (length=3)
'RI_zvl_ID_tooltipfield' => string '151' (length=3)
7 => string '' (length=0)
'RI_DateTime' => string '' (length=0)
8 => null
'RI_ZVL_ID_NEW' => null
'rsnew' =>
array (size=5)
'RI_FullDateYYYYMMDD' => string '2018-06-09' (length=10)
'RI_Dienst_ID' => string '18' (length=2)
'RI_ZVL_ID' => null
'RI_locatie' => string 'ZUID' (length=4)
'RI_ZVL_ID_NEW' => string '151' (length=3)
'arts_wordt' => null
'arts_was' => string '151' (length=3)
'sarts' => null
'dart' => string '' (length=0)
'DR_RI_ID' => string '25046' (length=5)
'DR_FULLDATE' => string '2018-06-09' (length=10)
'DR_Dienst_ID' => string '18' (length=2)
'DR_Date_Ruil' => string '2017-12-01' (length=10)
'CT' => string '12:32:47' (length=8)
'CU' => string '1' (length=1)
'DUMMY' => string '' (length=0)
'MyResult' =>
object(ADORecordSet_empty)[134]
public 'fields' => boolean false
public 'EOF' => boolean true


bobmulder5555
User
Posts: 60

Post by bobmulder5555 »

Hmmz, I found it. The field to change was a text field instead of select field in edit tag. Now working like a charm. I did activate Allow sort/search & text input for search in LookupTable as sangnandar asked this. So either one is the solution.

For those looking in on this: I'm using the row_updating event. Even when in Gridedit mode the listed rows are processed one by one.


Post Reply