我只是想在 OctoberCMS 后端建立一个关系,其中子表单应该从父表单中获取一个值作为建议(默认)。
详细地说,有两个模型通过 belongsTo 关系(参加者属于锦标赛)第一个父模型(field.yaml)覆盖体育锦标赛:
tournament:
# ... some other fields
start_date:
label: Start date
type: date
attendees:
label: Attendees
type: partial
参加者的第二个儿童模型:
attendee:
name:
label: Name
type: text
start_date:
label: Start date
type: date
# how to get the value from tournament->start_date as preset?
父表格(在体育比赛中)具有开始日期以及相关的部分涵盖参加比赛的运动员。每个运动员还有一个单独的开始日期字段,我想在父锦标赛表格调用此表格时预先填写比赛的开始日期。但它必须是可编辑的,因为并非所有与会者都会在同一天开始。
有一个内置函数可以使用来自同一表单的另一个字段的值预设一个字段,但不幸的是我找不到如何从父表单获取值的解决方案。
提前致谢!