Home  >  Article  >  Web Front-end  >  Validform validates the instance according to the specified format

Validform validates the instance according to the specified format

小云云
小云云Original
2018-01-04 13:55:161376browse

Question: It can be empty, but when it is not empty, the data needs to be verified according to the specified format. How to implement it? This article mainly introduces the relevant information that Validform can be empty during verification or it can be verified according to the specified format. Friends who need it can refer to it. I hope it can help everyone.

View the document:

After version 5.2.1, datatype supports:

1. Direct binding regularity: If available, write like this datatype="/\w{3,6}/i", requires 3 to 6 characters, not case-sensitive;

2. Supports simple logical operations: such as datatype="m | e, *4-18 | /\w{3,6}/i | /^validform\.rjboy\.cn$/";

can be written as a solution Datatype of the question

datatype = "/^\s*$/|s3-25"

Explanation: /^\s*$/ is empty for verification The regular expression "|" in the value is followed by the format that needs to be verified

or extended datatype


##

$("form.demo").Validform({
 datatype: {
    "empty": /^\s*$/
    }
});

Use:


datatype = "empty|e"

Related recommendations:


Validform form validation summary

How to judge AJAX verification submission between php and Validform() Give reminder information?

Validform+layer implements beautiful form validation effects_jquery

The above is the detailed content of Validform validates the instance according to the specified format. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn