如何在 october cms 的下拉列表中添加默认值?
How to add default value in drodown in october cms?
在 Fields.yaml 文件代码是:
category:
label: Category
nameFrom: category_name
descriptionFrom: description
span: auto
type: relation
我的控制器代码是:
public $belongsTo = [
'category' => [
'Ashish\Taeq\Models\RecipeCategory',
'conditions' => 'status = 1'
],
我需要像 "Please select category" 那样设置默认类别下拉列表。
请使用
emptyOption: " "
开启 开启 Fields.yaml
category:
label: Category
nameFrom: category_name
descriptionFrom: description
span: auto
type: relation
emptyOption: " "
或请按以下link : https://octobercms.com/forum/post/filtering-form-fields-with-dependson-problem
在 Fields.yaml 文件代码是:
category:
label: Category
nameFrom: category_name
descriptionFrom: description
span: auto
type: relation
我的控制器代码是:
public $belongsTo = [
'category' => [
'Ashish\Taeq\Models\RecipeCategory',
'conditions' => 'status = 1'
],
我需要像 "Please select category" 那样设置默认类别下拉列表。
请使用
emptyOption: " "
开启 开启 Fields.yaml
category:
label: Category
nameFrom: category_name
descriptionFrom: description
span: auto
type: relation
emptyOption: " "
或请按以下link : https://octobercms.com/forum/post/filtering-form-fields-with-dependson-problem