Hello,
I have an "edit existing record" form which can show the existing field data and update the record if user changes the field data.
However, if user changes the fields to empty, or uncheck some check-boxes, the fields in the existing record will not be changed. I hope the fields can be changed to NULL instead.
I tried setting the below before DB save but it doesn't work:
Please advise~ Thanks a lot!
I have an "edit existing record" form which can show the existing field data and update the record if user changes the field data.
However, if user changes the fields to empty, or uncheck some check-boxes, the fields in the existing record will not be changed. I hope the fields can be changed to NULL instead.
I tried setting the below before DB save but it doesn't work:
foreach ($form->data as $name => $value) {
if (empty($value) and '0' != $value) {
$form->data[$name] = NULL;
}
}
Please advise~ Thanks a lot!