Hello,
In livewire 1.3 app looking at DatePicker example at laravel-livewire docs
I can not see how to set custom parameter to and to use it when date is selected?
I need to put into hidden input formated date for saving in db.
I add 1 parameter in attributes:
<x-date-picker
wire:model="start_date"
id="start_date"
autocomplete="off"
attributes="{hidden_element:'hidden_start_date'}"
/>
and in resources/views/components/date-picker.blade.php :
and try to read in in date selection event:
<div>
<input
x-data
x-ref="input"
x-init="new Pikaday({
field: $refs.input,
format:'M/D/YYYY',
onSelect: function() {
console.log(this.el); // that shows html code of datepicker
console.log('getAttribute:');
console.log(this.el.getAttribute('hidden_element')); // shown null
$( this.el.getAttribute('hidden_element') ).val( dateToMySqlFormat(this._d) );
// code above does not work !
}
})"
type="text"
{{ $attributes }}
>
</div>
Which is the valid way ?
Thanks!