I'm trying to insert data into my database but I cannot seem to get this date of birth form to be accepted. Here's a jsfiddle of what my form is https://jsfiddle.net/10990b6t/2/ however when I try send this data into my database it just returns me to the register page. I previously had a plain textbox and it worked fine but obviously doesn't have the javascript making the form a lot better.
--Old textbox that worked--
<label for="title">Date of Birth</label>
<input type="text" name="dateofbirth" id="dateofbirth">
</div>
--New attempt at form that doesn't work-- registerForm.blade.php
<input
type="text"
name="date"
id="dateofbirth"
placeholder="dd/mm/yyyy"
onkeyup="
var v = this.value;
if (v.match(/^\d{2}$/) !== null) {
this.value = v + '/';
} else if (v.match(/^\d{2}\/\d{2}$/) !== null) {
this.value = v + '/';
}"
maxlength="10"
>
AuthController.php
function registerUser(Request $request)
{
$this->validate($request, [
'firstname' => 'required|min:3|max:25',
'surname' => 'required',
'address' => 'required',
'postcode' => 'required',
'email' => 'required|min:5|max:30|unique:users',
'password' =>'required|min:5|max:30|',
'dateofbirth' => 'required',
]);
//create a User object
$user = new User();
$user->firstname = $request->firstname;
$user->surname = $request->surname;
$user->address = $request->address;
$user->postcode = $request->postcode;
$user->email = $request->email;
$user->password = $request->password;
$user->dateofbirth = $request->dateofbirth;
$user->role = 1;
$user->save();
return redirect('all');
}
via TF120