function formValidate(f) { if (document.formvalidator.isValid(f)) { f"/> function formValidate(f) { if (document.formvalidator.isValid(f)) { f">

Home >Backend Development >PHP Tutorial >joomla forum How to use joomla's built-in form validation function

joomla forum How to use joomla's built-in form validation function

WBOY
WBOYOriginal
2016-07-29 08:43:04972browse

Here’s how to use it:
Enter the following code at the top of the page where you want to use the form function
JHTML::_('behavior.formvalidation');
Then add the following script to the page

Copy the code Code As follows:




Modify the code in the form

Copy the code The code is as follows:

Customized verification method:
Joomla verification function supports customization, and you can set uncommon ones Validation rules.
For example, if I want to add a password item and a confirmation password item, the values ​​of the two input boxes must be equal before submission. You can add the following script

Copy the code The code is as follows:


document.formvalidator.setHandler(' passverify', function (value) { return ($('password').value == value); });

The above introduces how to use joomla forum's built-in form verification function, including the content of joomla forum. I hope it will be helpful to friends who are interested in PHP tutorials.

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