Closed p4rad0xus closed 8 months ago
I think you can access the data by using form.start_date
and form.end_date
. Just like you would use data.some_variabele
in a <x-splade-data>
tag
Thank you for your answer but I don't want to use the value from the input field in the form.
The field display the passing data on the website. If I submit the form and want to get the value of the field in the FormRequest class with $this->date_range
its returns null
.
Example The Model $myModel contains the following values:
In the Blade file I use this form:
<x-splade-form :default="$myModel">
<x-splade-input name="name" />
<x-splade-input name="date_range" date="{defaultDate: '{{ $myModel->start_date }} to {{ $myModel->end_date }}'}" range />
</x-splade-form>
On the website I see the expected values also the DOM for the input field with the name attribute "date_range".
If the unchanged form is submitted the intended FormRequest class receive on $this->name
the value "Model 1" and under $this->date_range
the value null.
Only if the period is selected again do I receive a string in the FormRequest.
Description:
In a Blade file I use a
x-splade-form
to edit a Model. The Model contains an attribute named "start_date" and "end_date". This attributes contains a string with a date in the format "Y-m-d". The information for this attributes comes from ax-splade-input date range
field and will be separated.To edit the date in the form I want also to use
x-splade-input date range
. But I don't know how to fill the input field with the informations of "start_date" and "end_date. With the config optiondefaultDate
on the date attribute I can set a date which would be shown, but the submitted form does contains instead a empty string.Form to edit