mvccore/ext-form-field-selection 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mvccore/ext-form-field-selection

Composer 安装命令:

composer require mvccore/ext-form-field-selection

包简介

MvcCore - Extension - Form - Field - Selection - form field types - select, country select, checkbox, radio button, color and checkboxes group.

README 文档

README

Latest Stable Version License PHP Version

MvcCore form extension with fields select, country select, checkbox(es), radios and color.

Installation

composer require mvccore/ext-form-field-selection

Fields And Default Validators

  • select, country select
    • ValueInOptions
      • configured by default
      • validate if submitted string(s) are presented in select options keys.
  • input:checkbox
    • SafeString
      • configured by default
      • XSS string protection to safely display submitted value in response, configured by default
  • input:radio - radio group and input:checkboxes - checkbox group
    • ValueInOptions - configured by default, ...description above
  • input:color
    • Color
      • configured by default
      • validate hexadecimal color with no transparency including leading hash char #

Features

  • always server side checked attributes required, disabled and readonly
  • all HTML5 specific and global atributes (by Mozilla Development Network Docs)
  • every field has it's build-in specific validator described above
  • every build-in validator adds form error (when necessary) into session and than all errors are displayed/rendered and cleared from session on error page, where user is redirected after submit
  • any field is possible to render naturally or with custom template for specific field class/instance
  • very extensible field classes - every field has public template methods:
    • SetForm() - called immediatelly after field instance is added into form instance
    • PreDispatch() - called immediatelly before any field instance rendering type
    • Render() - called on every instance in form instance rendering process
      • submethods: RenderNaturally(), RenderTemplate(), RenderControl(), RenderLabel() ...
    • Submit() - called on every instance when form is submitted

Examples

Basic Example

$form = (new \MvcCore\Ext\Form($controller))->SetId('job_hunting');
...
$jobQual = new \MvcCore\Ext\Forms\Fields\Select;
$jobQual
	->SetName('job_qualification')
	->SetLabel('Job Qualificatio:')
	->SetOptions([
		'junior'	=> 'Junior Developer',
		'senior'	=> 'Senior developer',
		'manager'	=> 'IT Manager',
	]);
$gender = new \MvcCore\Ext\Forms\Fields\Radio([
	'name'		=> 'gender',
	'label'		=> 'Gender:',
	'options'	=> [
		'M'			=> 'Male',
		'F'			=> 'Female',
		'O'			=> 'Other',
	],
]);
$country = new \MvcCore\Ext\Forms\Fields\CountrySelect([
	'name'		=> 'country',
	'label'		=> 'Country:',
	'filter'	=> ['DE', 'AT', 'FR', 'NL'],
]);
$skills = new \MvcCore\Ext\Forms\Fields\CheckboxGroup([
	'name'		=> 'skills',
	'label'		=> 'I control programming languages:',
	'options'	=> [
		'html'		=> 'HTML5',
		'css'		=> 'CSS3',
		'js'		=> 'Javascript',
		'ts'		=> 'Typescript',
		'php'		=> 'PHP',
		'cs'		=> 'C#',
		'vb'		=> 'Visual Basic',
		'java'		=> 'Java',
		'py'		=> 'Python',
		'pl'		=> 'Perl',
	],
]);
$public = new \MvcCore\Ext\Forms\Fields\Checkbox([
	'name'		=> 'public',
	'label'		=> 'Yes, anybody could see my profile.',
	'checked'	=> TRUE,
]);
$color = new \MvcCore\Ext\Forms\Fields\Color([
	'name'		=> 'profile_color',
	'label'		=> 'My profile color:',
	'value'		=> '#0000FF',
]);

...
$form->AddFields($jobQual, $gender, $country, $skills, $public, $color);

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-09-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固