【发布时间】:2021-10-27 15:56:22
【问题描述】:
I am using agile toolkit code for developing an application , i do have dropdown that get values from database, I want to show selected value from field 1 to field 2 without submit any thing.
$form->addField('field1', ['caption' => 'Field 1', 'DropDown', 'values'=> $arra1,'isMultiple' => true ,'readonly' => false, ['dropdownOptions' => ['fullTextSearch' => true]]]);
$form->addField('field2', ['caption' => 'Select Specfic Values', 'DropDown','model' => new view_values($db),'dependency' => function (view_values $模型,$数据) {isset($data['field1']) ? $model->addCondition($model->fieldName()->id, 'like', '%' . $data['field1'] . '%') : null;} ,'isMultiple' => true ,'readonly' => false, ['dropdownOptions' => ['fullTextSearch' => true]]]);
问题是致命错误 atk4\ui\Exception: Unable to add form field (), object: atk4\ui\FormField\DropDown () property: "dependency" value: {}。寻求帮助。也许我的逻辑是错误的。
【问题讨论】:
-
花点时间阅读帮助中心的editing help。 Stack Overflow 上的格式化与其他站点上的不同。您的帖子看起来越好,其他人就越容易阅读和理解它。
-
请澄清您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
-
嗨,谢谢大家的回复,我正在使用敏捷工具包开发应用程序,如果有意义的话,我正在寻找级联两个下拉字段值的工作示例,任何关于如何完成的想法!
-
我在这里使用了示例 ui.agiletoolkit.org/demos/form-control/lookup-dep.php ,但我遇到了与 ('dependency' => ) 不同的问题,因为表单不想构建 addfield !所以我正在寻找一个更好更简单的例子,我可以有 2 个字段下拉列表,一旦第一个字段选择第二个字段,就从模型中显示选定的值!
标签: php field agile atk4 agiletoolkit