Smarty package YII2 Form API - Switch Switch

WBOY
Release: 2016-07-29 09:06:13
Original
1257 people have browsed it

Form element name: switch

Basic call format:

{input type='switch' model=$model field='is_parent' value='1' uncheck='0' items=[0='否, '1'=>'是']} 
Copy after login

API description:

1. The "type" of the switch must be switch

2.value specifies the value when checked, the default is 1; uncheck specifies The value when unchecking is specified, the default is 0.

3.items specifies the text on the switch, the type is an array, the key corresponds to the attribute value of value and uncheck, and the value corresponds to the displayed text. The default properties of

4.items are:

['0'=>'否', '1'=>'是']
Copy after login

Rendering:


Smarty package YII2 Form API - Switch SwitchSmarty package YII2 Form API - Switch Switch

The above introduces the Smarty package YII2 Form API - Switch, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!