当前位置:网站首页>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
- 3-2 host discovery - layer 3 discovery
- Flume configuration 3 - interceptor filtering
- 【编译原理】语义分析
- Flume配置2——监控之Ganglia
- 软件测试逻辑覆盖相关理解
- Summary of swift optional values
- Ovirt database modify delete node
- Nutch2.1 using eclipse debug to store the build process in MySQL on the windows platform
- 云服务器的安全设置常识
猜你喜欢
随机推荐
数据链路层
并查集(Union-Find)
1404萬!四川省人社廳關系型數據庫及中間件軟件系統昇級采購招標!
通过MeterSphere和DataEase实现项目Bug处理进展实时跟进
Etcd database source code analysis - put process of server
Flume configuration 4 - Custom source+sink
.NetCore统一认证授权学习——第一次授权(2)
Luoqingqi: has high-end household appliances become a red sea? Casati took the lead in breaking the game
PowerShell command outputs only a list of directories
软件工程—原理、方法与应用
SSH command and instructions
Several policies of Shenzhen Futian District to support investment attraction in 2022
ASP.Net Core创建Razor页面上传多个文件(缓冲方式)(续)
Withdrawal of user curve in qualified currency means loss
Command execution (RCE) vulnerability
Flume理论
wangeditor富文本编辑器使用(详细)
[boutique] detailed explanation of Pinia
雪花id,分布式唯一id
Configuration du Flume 4 - source personnalisée + sink









