It would be nice to have a field for placeholder text on the date and time picker field. I’d like to be able to add some text like “enter date here”
PS I know there is an instruction field. 🙂
Hi @theshae
You should be able to do it by using JavaScript code to add a placeholder . To add the JavaScript code, you can use the acf/input/admin_footer hook. Here’s an example of the code:
function my_acf_add_datepicker_placeholder() {
?>
<script type="text/javascript">
(function($){
// only do this after the assets are fully loaded
acf.add_action('load', function( $el ){
// add the placeholder
$(".acf-date-time-picker input.hasDatepicker").attr( "placeholder", "enter date here" );
});
})(jQuery);
</script>
<?php
}
add_action('acf/input/admin_footer', 'my_acf_add_datepicker_placeholder');
I hope this helps 🙂
a couple of notes:
1. You can add a specific field’s class on this to differentiate start and end date placeholders, for example.
2. You can’t use the above with repeaters, and nothing I’ve been able to find short of either creating a new custom field or doing some complex render_field_settings and render_field hooks in functions can resolve this.
It will show the placeholder in the first repeater row, but not in the subsequent ones.