Duplicate, in itself, work fine. However when I duplicate the field I need to:
{
extend: "selected",
text: 'Duplicate',
action: function ( e, dt, node, config ) {
// Start in edit mode, and then change to create
editor
.edit( table.rows( {selected: true} ).indexes(), {
title: 'Duplicate record',
buttons: 'Create from existing'
} )
.mode( 'create' );
}
},
1) Set publish to No
2) With 2 date field I need to update them the first one to now and the second to 30 days ahead. This code gets those values:
$today = date('Y-m-d');
$date_plus_30 = date('Y-m-d', strtotime("+30 days"));
If not using duplicate I do something like:
{
label: 'Date begins (this must be updated)',
name: 'date_begins',
default: '<?php echo $today; ?>',
attr: { placeholder: "Format: YYYY-MM-DD" },
},
{
label: 'Date ends (this must be updated)',
name: 'date_ends',
default: '<?php echo $date_plus_30; ?>',
attr: { placeholder: "Format: YYYY-MM-DD" },
},
However with duplicate those values get overwritten.