onPreSave event and Update method of tmysql
Publicado: Lun Ene 09, 2012 12:29 am
please, see the fragment code below:
...bla, bla, bla
// customer is a dataset, obviously
customer:OnPreSave := { |oSender| Empty(oSender:Name) }
/*
it means, I guess, that the update process will be stoped if the customer's name is empty, right?
But the update() process returns .T. EVEN if onpresave event says .T.!
The update() returns .F. only if onpresave returns .F. too!
It means that onpresave does not returns lCancel as the documentation says, but lSave...
*/
// some code here to show the form, edit, etc
// the customer_update function will be used to update the dataset
...bla, bla, bla
FUNCTION customer_update(customer)
IF customer:update()
messagebox("saved")
// ok, the datafields are saved and the dataset returns do its normal state
ELSE
messagebox("ops!")
/*
the dataset returns to its normal state and I can't continue modifying the datafields!
So, what do I have to do to keep editing?
*/
ENDIF
RETURN nil
help!
...bla, bla, bla
// customer is a dataset, obviously
customer:OnPreSave := { |oSender| Empty(oSender:Name) }
/*
it means, I guess, that the update process will be stoped if the customer's name is empty, right?
But the update() process returns .T. EVEN if onpresave event says .T.!
The update() returns .F. only if onpresave returns .F. too!
It means that onpresave does not returns lCancel as the documentation says, but lSave...
*/
// some code here to show the form, edit, etc
// the customer_update function will be used to update the dataset
...bla, bla, bla
FUNCTION customer_update(customer)
IF customer:update()
messagebox("saved")
// ok, the datafields are saved and the dataset returns do its normal state
ELSE
messagebox("ops!")
/*
the dataset returns to its normal state and I can't continue modifying the datafields!
So, what do I have to do to keep editing?
*/
ENDIF
RETURN nil
help!