Set default value on Datetime feild on add form to now

Hello,

Can anyone help me with an example on how to set the default value of a datetime field to now so that when the add form is opened the current date time is set?

Thanks,

Hello @markab and welcome to our forums :hugs:

You can use: callbackAddForm for add form and callbackEditForm for edit form.

The documentation also has an example so I guess it will be straight forward. Let me know if that worked for you.

Regards
Johnny

Thanks…

	$crud->callbackAddForm(function ($data) {
	
		$data['san_created_date'] = date('d/m/Y H:i:s');

		return $data;
	});