chris.paschen
Chris Paschen
I have an element that is of the type "date".
I need to manually push the current date to this field is a piece of code on a form plugin.
The PHP code is running onBeforeProcess (although I've tried onBeforeStore also with similar results)
The code that I'm running is:
$now = new DateTime();
$formModel->formData['ked_books_reviews_requests_49_repeat___date_accepted'] = $now;
If I run a dump of the value right after that line I can see that the current date has been set into that element; however, after saving the form the date isn't there (just 0000-00-00 etc.)
I've also tried using:
$formModel->updateFormData('ked_books_reviews_requests_49_repeat___date_accepted_raw',$now,true);
but nothing seems to actually get the value to store to the field in the table.
I have a number of similar date (datetime) fields that need to be via code, but I can't seem to get them to set via updateFormData or pushing into the field via formModel->formData.
I'm guessing I just have a syntax (or process script location) error.
Any ideas how to make this work?
I need to manually push the current date to this field is a piece of code on a form plugin.
The PHP code is running onBeforeProcess (although I've tried onBeforeStore also with similar results)
The code that I'm running is:
$now = new DateTime();
$formModel->formData['ked_books_reviews_requests_49_repeat___date_accepted'] = $now;
If I run a dump of the value right after that line I can see that the current date has been set into that element; however, after saving the form the date isn't there (just 0000-00-00 etc.)
I've also tried using:
$formModel->updateFormData('ked_books_reviews_requests_49_repeat___date_accepted_raw',$now,true);
but nothing seems to actually get the value to store to the field in the table.
I have a number of similar date (datetime) fields that need to be via code, but I can't seem to get them to set via updateFormData or pushing into the field via formModel->formData.
I'm guessing I just have a syntax (or process script location) error.
Any ideas how to make this work?