定制 codaxis/cakephp-parsley-helper 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

codaxis/cakephp-parsley-helper

Composer 安装命令:

composer require codaxis/cakephp-parsley-helper

包简介

CakePHP Form Helper for Parsley.js automatic validation integration

README 文档

README

DEPRECATION WARNING: This plugin is not maintained anymore.

CakePHP Form Helper for Parsley.js automatic validation integration

This helper will automatically read validation rules from active form model and assign field attributes accordingly.

Compatible with Cake 2.4.7+

Feel free to make any code/docs contributions or post any issues.

Basic usage

  1. Enable the helper plugin in your app/Config/bootstrap.php by doing CakePlugin::load('ParsleyHelper'); - or just CakePlugin::loadAll();.

  2. Load helper in your app/Controller/AppController.php. You can use the classname option if you want to keep your helper alias as "Form".

    // In AppController.php
    
    public $helpers = array('ParsleyHelper.ParsleyForm');
    // or
    public $helpers = array('Form' => array('className' => 'ParsleyHelper.ParsleyForm'));
  3. Enable Parsley rules integration in any form by setting parsley => true or data-parsley-validate => true in Form->create() options array.

    echo $this->Form->create('MyModel', array('parsley' => true));
  4. That's all! When you create an input field, parsley attributes will be set according to the defined validation rules.

Trait usage

If you are running PHP 5.4 or greater, and already using a custom or vendor form helper, you can make use of provided ParsleyFormTrait and retain both helper functionalities. You can do so by creating a custom helper in your app/View/Helper folder like this:

// In app/View/Helper

App::uses('ParsleyFormTrait', 'ParsleyHelper.View/Helper');

class MyFormHelper extends VendorFormHelper {
	use ParsleyFormTrait;
}

统计信息

  • 总下载量: 108
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-04-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固