Dijit 中的文本字段组
我有一个场景。在其中一个表单中,3 个一组中有 18 个字段,但一次只能有一组(3 个字段)具有值。 任何人都可以告诉我如何以最好的方式做到这一点,是否有类似在 dijit 中创建字段组之类的事情? 我可以通过 javascript 做到这一点,但该脚本非常难看,请告诉我是否有一些标准方法可以做到这一点或一些最佳方法。
表单上有一个下拉菜单,根据下拉值字段将启用/禁用。但对于下拉列表中的一个值,应启用所有字段(字段组),并让用户决定要输入哪一组字段。但用户可以输入一组字段(他可以选择)。因此,禁用该字段不是一个选项。通过 javascript 函数检查相同的内容看起来不太好。 希望这能澄清更多。 谢谢
I am having a scenario. In one of the form there are 18 fields in the group of 3, but only one group(3 fields) can have value at a time.
Can any please tell me how can i do this in the best way, is there any thing like creating group of fields in dijit?
I can do this via javascript but that script is very ugly please tell me if there is some standard way to do this or some best approach.
There is a dropdown on the form, on the basis of dropdown value fields will be enabled / disabled. But for one value in the dropdown all the fields(group of fields) should be enabled and let users to decided which group of fields he wants to enter. But user can enter one group of fields(which he can choose). So disabling the field is not an option & checking the same via javascript function doesn't look gud.
Hope this clerified more.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为一个很好的方法是拥有一个控制器小部件,创建“组”小部件。
在组小部件上,您将有一个 onFocus 函数和一个 resetFields 函数。
在每个组中,您将连接 onFocus 字段,并调用回调组函数“onFocus”。然后controlelr小部件将调用所有其他组小部件并执行resetFields。
组小部件的 ResetField 函数将清除组字段的值。
这样的东西听起来足够干净吗?
I think a nice approach would be to have a controller widget, creating "group" widgets.
On the group widget you would have a onFocus function, a resetFields function.
in each group you would connect on the fields onFocus, and call the callback group function "onFocus". Then the controlelr widget would call all other group widget and do a resetFields.
The group widget resetField function would clear values of the group's fields.
Something like that sounds clean enough ?