XFORMS 多选选项绑定问题
我有一个选择控件,允许选择多个值。
当我在该控件中选择值时,它会将值添加到带有空格的同一节点中。
当我们选择和取消选择时,是否可以创建/删除新的/现有的节点。
I have select control which allows to select more than one value.
As and when i select values in that control, it adds the value into same node with a space.
Is it possible to create/delete a new/existing node when we select and deselect.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
XForms 具有
xforms:copy
元素,理论上您可以在项集中使用它,并且它可能对您有用,但我不知道目前是否有任何 XForms 实现支持此功能。 Orbeon Forms 则不然。Phil的回答是一个可能的方向。另一种选择是仍然使用 xforms:select/select1 并响应 xforms-select/xforms-deselect 事件来插入/删除节点。以下适用于 Orbeon:
XForms has the
xforms:copy
element, which you can in theory use in itemsets, and which might have worked for you, but I don't know if any XForms implementation supports this at this time. Orbeon Forms doesn't.Phil's answer is a possible direction. Another option is to still use
xforms:select/select1
and react to thexforms-select/xforms-deselect
events to insert/delete nodes. The following works with Orbeon:select
元素不太符合您的要求,因为它只有一个节点绑定。我不会尝试以这种方式颠覆控件的语义,而是使用带有insert
和delete
trigger 元素的repeat
code> actions,使用 CSS 进行样式设置,以提供多选控件的外观。您的问题没有提到数据的格式,但假设像这样的实例数据:
那么您应该能够通过以下方式获得您想要的行为(未测试):
The
select
element is a poor match for your requirements because it only has a single node binding. Instead of trying to subvert the control's semantics in that way, I would use arepeat
oftrigger
elements withinsert
anddelete
actions, styled with CSS in such a way as to provide the appearance of a multi-selection control.Your question doesn't mention the format of the data, but supposing instance data like this:
Then you should be able to get the behaviour you want with something along these lines (not tested):