当前位置:网站首页>fastadmin后台设置单选按钮
fastadmin后台设置单选按钮
2022-06-29 20:05:00 【不愿透漏姓名的靓仔】
首先放上数据库字段截图

直接上代码
add:
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Shop')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="shopList" item="vo"}
<label for="row[shop]-{$key}"><input id="row[shop]-{$key}" name="row[shop]" type="radio" value="{$key}" {in name="key" value="2"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>edit:
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Shop')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="shopList" item="vo"}
<label for="row[shop]-{$key}"><input id="row[shop]-{$key}" name="row[shop]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>上边要注意一个点 就是foreach内的name中的字段
需要在对应的控制器内_initialize()内加上下面的代码
$this->view->assign("shopList", $this->model->getShopList());然在对应的模型(model)中加上对应的方法
public function getShopList()
{
return ['1' => __('Shop 1'), '2' => __('Shop 2')];
}边栏推荐
- data link layer
- Connaissance générale des paramètres de sécurité du serveur Cloud
- Snowflake ID, distributed unique ID
- How to solve the problem of insufficient memory space in Apple iPhone upgrade system?
- Freemaker template framework generates images
- Etcd database source code analysis - put process of server
- jfinal中如何使用过滤器监控Druid监听SQL执行?
- ASP. Net core creates razor page and uploads multiple files (buffer mode) (Continued)
- The era of data security solutions
- Zotero journal automatic matching update influence factor
猜你喜欢

【Try to Hack】vulnhub narak

畫虎國手孟祥順數字藏品限量發售,隨贈虎年茅臺

How to solve the problem of insufficient memory space in Apple iPhone upgrade system?

Deficiencies and optimization schemes in Dao

Configuration du Flume 4 - source personnalisée + sink

ASP. Net core creates razor page and uploads multiple files (buffer mode) (Continued)

.NetCore统一认证授权学习——第一次授权(2)

Linux Installation mysql8

Hangfire details

La collection numérique Meng xiangshun, artiste national du tigre peint, est disponible en quantité limitée et est offerte avec Maotai de l'année du tigre
随机推荐
[observation] softcom power liutianwen: embrace change and "follow the trend" to become an "enabler" of China's digital economy
Following the crowd hurts you
Sword finger offer 41 Median in data stream
Software engineering - principles, methods and Applications
Zotero期刊自動匹配更新影響因子
命令执行(RCE)漏洞
How to use filters in jfinal to monitor Druid for SQL execution?
Flume配置1——基础案例
ETCD数据库源码分析——服务端PUT流程
WPS and Excelle
A keepalived high availability accident made me learn it again!
社区访谈丨一个IT新人眼中的JumpServer开源堡垒机
As the "only" privacy computing provider, insight technology is the "first" to settle in the Yangtze River Delta data element circulation service platform
Chapter II (physical layer)
童年经典蓝精灵之百变蓝爸爸数字藏品中奖名单公布
Nutch2.1 distributed fetching
数据链路层
日本樱桃一颗拍出1980元天价,网友:吃了有上当的感觉
从众伤害的是自己
【U盘检测】为了转移压箱底的资料,买了个2T U盘检测仅仅只有47G~