Pear :: HTML

xiaoxiao2021-03-06  72

Client verification:

As mentioned earlier, use addRule () to add a verification rule, in fact, addRule () also has a fifth parameter -client. This parameter is used to explain that we will use the client verification. If this parameter is passed, the program will automatically generate the client's JavaScript code to verify the data in the form.

Using client validation is more fast and convenient, and you can reduce the load of the server.

Client.php

// Add three client verification rules $ form-> addrule ('name', 'username can't be empty!', 'Required', '', 'client'); $ form-> addrule ('name', ' The username must be 3 or more letters or numbers ',' minlength ', 3,' client '); $ form-> addrule (' password ',' password can not be empty! ',' Required ',' ',' client ');

The effect is as shown:

figure 1:

figure 2:

转载请注明原文地址:https://www.9cbs.com/read-120169.html

New Post(0)