Multi dropdown date selection

Hi. I wonder if somebody could please advise on what I’m doing wrong.

I have a database column for a users date of birth ‘dob’ which is a standard MySQL date format (yyyy-mm-dd). In my blade component, I display this as three dropdowns (date, month and year). Ideally I’d use the HTML date input, but browser support is slightly lacking.

Anyway, I am able to split the date and bind it to the form successfully using the following:

public function mount()
{
    $this->user->dob = explode('-', $this->user->dob);
}

The issue I have is when I save the form. I get the message “Cannot bind property [user.dob.2] without a validation rule present”.

I’d like to know how to implode the date array back into a string before validating the value.

I hope this makes sense. Thanks.

You can make separate properties for the array data, example $day, $month, $year and when you got submit the form assign those to dbo property to be saved

Thanks - I will try that.