如何将下拉列表的默认值设置为相关下拉列表的默认值
请帮助以下人员:
我有3个相关表格
name,network_id,application_id)
网络(id,name,application_id)
应用程序(id,name)
Users (id, name, network_id, application_id) Networks (id, name, application_id) Applications (id, name)
(来自app_id和name为字段的应用程序列表)。用户可以选择网络以及他们希望使用的应用程序(从应用程序列表)。
A network will have a default application selected (from the list of applications with app_id and name as fields). A user can select the network as well as an application they wish to use (from list of applications).
我已经创建了模型,控制器和视图,并且所有下拉列表看起来都很好,并允许我选择一个值BUT如何设置用户的默认值>应用程序下拉到相应的网络> application_id?
I have created the models, controllers and views and and all the dropdowns appear fine and allow me to select a value BUT how would I set the default value of the Users>application dropdown to that of the corresponding Networks>application_id?
的帮助。
服务器端,即在Cake中尝试添加所选参数,即:
Server-side, i.e. in Cake try adding the selected parameter, viz:
echo $form->select(string $fieldName, array $options, mixed $selected, array $attributes, boolean $showEmpty)
其中 $ selected
是默认选项的值。
- 边,你必须使用javascript。
Client-side, you'll have to use javascript.