You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the ability to add and update service options. When adding a new service option it doesn't seem to trigger the validation. I have a Create and an Edit component, both of which are just a wrapper with the post route and call the form component.
Both of these call the same OptionForm component which has all the form fields etc. They also use the same request on the backend
public function store(StoreServiceOptionRequest $request... public function update(StoreServiceOptionRequest $request...
class StoreServiceOptionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|string',
'type' => 'required|string',
'help_text' => 'nullable|string',
'price' => 'nullable',
'price_config' => 'nullable|string',
];
}
}
When I submit the create form I get no validation errors, when I submit the edit form I do. Here is a breakdown showing the initial mounting of the blank form object, then submitting, and it returning success.
Then mounting the existing object, submitting after removing the name field, and it returning an error.
I did notice that it defaults to an empty string instead of null, so tested with that and it is still incorrectly successful.
For context at the very top-level these exist in modals on the service page
I have the ability to add and update service options. When adding a new service option it doesn't seem to trigger the validation. I have a Create and an Edit component, both of which are just a wrapper with the post route and call the form component.
Create
Edit
Both of these call the same OptionForm component which has all the form fields etc. They also use the same request on the backend
public function store(StoreServiceOptionRequest $request...
public function update(StoreServiceOptionRequest $request...
When I submit the create form I get no validation errors, when I submit the edit form I do. Here is a breakdown showing the initial mounting of the blank form object, then submitting, and it returning success.
Then mounting the existing object, submitting after removing the name field, and it returning an error.
I did notice that it defaults to an empty string instead of null, so tested with that and it is still incorrectly successful.
For context at the very top-level these exist in modals on the service page
Stack:
The text was updated successfully, but these errors were encountered: