动态表单 - select、radio input 数据引用
User 69e88e27
发布于:2025-09-12
当select表单需要使用其他页面的用户输入值作为当前 表达的候选值时,可以通过使用 choices_from
key 引用其他数据源作为候选值。
使用时原 choices
参数改为 choices_from
。以下为 choices_from 可选值:
$self.[setting_key]
从当前页面获取动态表单的值,作为 choices 数据$index.[setting_key]
从首页页面获取动态表单的值,作为 choices 数据$parent.[setting_key]
从当前页面的上级获取动态表单的值,作为 choices 数据$site.[setting_key]
从站点(settings_schema.json)获取动态表单的值,作为 choices 数据$site_user_group
从站点用户组获取数据
被引用的数据返回值必须为 数组 或 textarea input 的输出值
示例:
# $self.[setting_key]
{
"id": "keywords",
"type": "radio",
"choices_from": "$self.keywords_options"
"label": "关键词",
"info": "从当前页面指定的关键词中选择"
}
# $index.[setting_key]
{
"id": "keywords",
"type": "radio",
"choices_from": "$index.keywords_options"
"label": "关键词",
"info": "从首页页面指定的关键词中选择"
}
# $parent.[setting_key]
{
"id": "keywords",
"type": "radio",
"choices_from": "$parent.keywords_options"
"label": "关键词",
"info": "从当前页面的上级指定的关键词中选择"
}
# $site.[setting_key]
{
"id": "city",
"type": "radio",
"choices_from": "$site.cities",
"label": "所在城市"
"info": "从首页设置城市选择"
}
# $site_user_group
{
"id": "user_group_ids",
"type": "select",
"choices_from": "$site_user_group",
"multiple": true,
"label": "用户组"
}