Please enable JS

Overview

Validating Form Arrays

  0 reviews
9.00

It happened to me many times before. I would write a sick new React.js component or glued together a quick jQuery script to enable users to add multiple instances of the same type on one form and then the dilemma would occur: "Should I just add array in validation rules for that field or would I create a custom validation rule for that specific type of field?".

The latest form that I am currently working on has the ability to add multiple device groups in which you can select the device type and enter the quantity for that device type. Meaning that I would have to have a exists validation rule for every device type field and an integer check for quantity with some other validation rules.

In this tutorial I will skip the JS part of generating the form and will show you how the form looks like, how the HTML should be formatted, how to write validation rules for form array and some extra tips on how to avoid multiple exists calls to the database that could slow down your application.

SAMPLE

SKU: validating-form-arrays
Author Mario Bašić
Words 1,032
Published At September 13, 2016
Last Updated October 06, 2017

No reviews yet.

Related Tutorials

Multilingual Web Application with Laravel: Multilingual CRUD

In this tutorial, we will cover creating, updating, deleting and viewing all multilingual articles.

9.00

Multilingual Web Application with Laravel: Model Translations

Handling multilingual models has never been easier.

9.00

Paginating a collection of different models

This is most commonly used in the situation where you have to paginate search results which consist of many different models.

9.00

Laravel API 101: CONSUME

We will create a new Laravel application which connects to the API that we have built in the previous lessons.

25.00  19.99

Laravel Forms & HTML

Everything you need to know about working with forms in Laravel. Based on Laravel Collective Forms & HTML package.

7.00

Laravel API 101: BUILD

In this lesson we will build an API using Laravel for managing news articles.

25.00  19.99
Instant Delivery
24/7 Customer Service
Payment Options
7 Days Refunds
Laravel
PHP
React.js
Vue.js
Composer
Nginx
Ubuntu
Linux
Windows
Codeception
MySQL
Lumen

Newsletter