Please help with form validation.
I want to replicate the register page but form validation is not working
this is my create and store methods
public function create(){
return view("associations.create");
}
// For the association creation
public function store(){
// Make validation
$attributes = request()->validate([
"name"=>["required","max:50"],
"sigle"=>["required","max:10","unique:associations,sigle"],
"description"=>["required"]
]);
// Create the Association
Association::create($attributes);
return redirect("/")->with("success","Congratulation");
}
<x-auth-layout>
<!--begin::Signup Form-->
<form class="form w-100 " novalidate="novalidate" id="kt_sign_up_form" action="{{ route("associations.create") }}">
@csrf
<!--begin::Heading-->
<div class="text-center mb-11">
<!--begin::Title-->
<h1 class="text-dark fw-bolder mb-3">{{ __("Add your first Association") }}</h1>
<!--end::Title-->
<!--begin::Subtitle-->
<div class="text-gray-500 fw-semibold fs-6">{{ __("")}}</div>
<!--end::Subtitle=-->
</div>
<!--begin::Heading-->
<!--end::Login options-->
<!--begin::Input group=-->
<div class="fv-row mb-8 fv-plugins-icon-container fv-plugins-bootstrap5-row-valid">
<input class="form-control form-control-lg form-control-solid" type="text" name="name" autocomplete="off" value="{{ old("name") }}" placeholder="Name of Association here" required/>
</div>
<!--begin::Input group=-->
<div class="fv-row mb-8 fv-plugins-icon-container fv-plugins-bootstrap5-row-valid">
<input class="form-control form-control-lg form-control-solid" type="text" name="sigle" autocomplete="off" value="{{ old("sigle") }}" placeholder="Sigle of Association here"/>
</div>
<!--begin::Input group=-->
<div class="fv-row mb-8 fv-plugins-icon-container fv-plugins-bootstrap5-row-valid">
<!--begin::Email-->
<textarea class="form-control form-control-solid" name="description" placeholder="Type description here">{{ old("description")}}</textarea>
<!--end::Email-->
</div>
<!--begin::Accept-->
<div class="fv-row mb-8 fv-plugins-icon-container">
<label class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" name="toc" value="1">
<span class="form-check-label fw-semibold text-gray-700 fs-base ms-1">I Accept the
<a href="#%22%20class=%22ms-1%20link-primary" target="_blank" rel="noopener noreferrer">Terms</a></span>
</label>
</div>
<!--end::Accept-->
<!--begin::Submit button-->
<div class="d-grid mb-10">
<button type="submit" id="kt_sign_up_submit" class="btn btn-primary">
@include("partials.general._button-indicator")
</button>
</div>
<!--end::Submit button-->
<!--begin::Sign up-->
<div class="text-gray-500 text-center fw-semibold fs-6">Already have an Account?
<a href="%7B%7B%20theme()->getPageUrl("login")%20%7D%7D%22%20class=%22link-primary%20fw-semibold" target="_blank" rel="noopener noreferrer">Sign in</a></div>
<!--end::Sign up-->
<div></div>
</form>
<!--end::Signup Form-->
</x-auth-layout>
Hi
The register form uses this JS file. If you want to replicate it, please update this JS file to match your form inputs and include it in your registration page.resources/assets/extended/js/custom/authentication/sign-up/general.js
Thanks