Thứ Sáu, 1 tháng 6, 2018

Waching daily Jun 2 2018

Form Validation in Model Table

Validating entities before saving is done automatically when using the newEntity(), newEntities(), patchEntity() or patchEntities()

Go to database access validation doc

use validating data before building entities

use users model

First create a users database table

error() function has been deprecated, use the getErrors() function instead

now create model table for validation

Create Users Table file in `src/Model/Table` folder

modify demo code

insert php namespace (App\Model\Table)

show form validation errors

Update registration file

Now send errors and data to registration template

And this variable name can be used in the template

Now you will see the error below the same field in which error occurs

Now set the error template

Modify the template according to the css of the form in Bootstrap 4

You can show the validation error in another way

Use this function to check the error of a unique field

This function sends us the boolean value

use if condition in html controls

Now we are getting the form validation error right

Now let's use the condition in all the controls like this

For more infomation >> #7 CakePHP 3.6 Beginner Video Tutorial - Form Validation in Model Table and set Error Template - Duration: 9:08.

-------------------------------------------

#6 CakePHP 3.6 Beginner Video Tutorial - Form Validation in User Registration Page - Duration: 5:26.

Access Request Body Data

Use validation in controller

Pass field name

now check some errors

get validation errors

add more fields in validation

For more infomation >> #6 CakePHP 3.6 Beginner Video Tutorial - Form Validation in User Registration Page - Duration: 5:26.

-------------------------------------------

#8 CakePHP 3.6 Beginner Video Tutorial - Advance Form Validation in Model Table - Duration: 5:32.

Using a different validation set

enter new validation name in array

create this function (validationUpdate) in users table file

Now it will only call the update validation function (validationUpdate)

change update validation type

add another validation rules

add password validations

add confirm password validation

add valid email validation

all errors successfully run

For more infomation >> #8 CakePHP 3.6 Beginner Video Tutorial - Advance Form Validation in Model Table - Duration: 5:32.

-------------------------------------------

#5 CakePHP 3.6 Beginner Video Tutorial - Creating Multiple Controls in login and register - Duration: 5:24.

creating multiple controls

Không có nhận xét nào:

Đăng nhận xét