You would need to edit the Datetime column, and go to the Editing tab. In there, change the "Editor input type" to be "One-line string" and add the placeholder %CURRENT_DATETIME% in the "Predefined value(s)" field, like this:
This is the only way to predefine the field, as the placeholder won't work for datetime editor input type. A drawback with this approach, however, is that if you want to modify the entry, you won't see the date picker, but instead you would need to manually type it in, just like a string.
Record Created 1. Added a new Field/column to the table "AddedOn" type DATETIME 2. Set Editor Input Type = NONE 3. In phpMyAdmin set the field to Default value CURRENT_TIMESTAMP 4. ALTER TABLE `wp_wpdatatable_1` CHANGE `addedon` `addedon` DATETIME NULL DEFAULT CURRENT_TIMESTAMP
Record Updated 1. Added a new Field/column to the table "UpdatedOn" type DATETIME 2. Set Editor Input Type = NONE 3. In phpMyAdmin set the field to Default value CURRENT_TIMESTAMP 4. ALTER TABLE `wp_wpdatatable_1` CHANGE `updatedon` `updatedon` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
how do I create a date/time field in the table that is automatically filled in?
Hello Andressa
You would need to edit the Datetime column, and go to the Editing tab. In there, change the "Editor input type" to be "One-line string" and add the placeholder %CURRENT_DATETIME% in the "Predefined value(s)" field, like this:
This is the only way to predefine the field, as the placeholder won't work for datetime editor input type. A drawback with this approach, however, is that if you want to modify the entry, you won't see the date picker, but instead you would need to manually type it in, just like a string.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hello Aleksandar,
This works for me -
Record Created
1. Added a new Field/column to the table "AddedOn" type DATETIME
2. Set Editor Input Type = NONE
3. In phpMyAdmin set the field to Default value CURRENT_TIMESTAMP
4. ALTER TABLE `wp_wpdatatable_1` CHANGE `addedon` `addedon` DATETIME NULL DEFAULT CURRENT_TIMESTAMP
Record Updated
1. Added a new Field/column to the table "UpdatedOn" type DATETIME
2. Set Editor Input Type = NONE
3. In phpMyAdmin set the field to Default value CURRENT_TIMESTAMP
4. ALTER TABLE `wp_wpdatatable_1` CHANGE `updatedon` `updatedon` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
Hope this helps.
Regards
Srinath
Awesome, Srinath, thanks for sharing that with us.
If you have any further questions or issues, please feel free to open a new ticket, and we'll gladly help.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables