我们可以将多个复选框控件绑定到单个 Domino 数据字段吗? [英] Can we bind multiple checkBox controls to a single Domino data field?

查看:36
本文介绍了我们可以将多个复选框控件绑定到单个 Domino 数据字段吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求创建多个 控件,所有控件都需要绑定到同一个 Domino 数据字段.如果这是一个普通情况,我会使用 控件,但这里的复选框需要分布在整个页面上.即:在各种 实例之间会有 控件.
因此,如果用户选择说三个复选框中的第一个,如果uncheckValue"属性留空,则生成的 Domino 字段将包含值false",因为最后一个复选框行显然覆盖了以前的值.只有当用户选中最后一个框时,该字段才会包含合适的值.
在普通"html 代码中,各种复选框只是使用name"属性连接起来的.但在 Xpages 中,该属性已被引擎复制动态控件 ID 使用并覆盖.

I'm asked to create multiple <xp:checkbox> controls all of them need to be bound to the same Domino data field. If this was an ordinary case I would use a <xp:checkBoxGroup> control, but here the checkboxes need to be spread all over the page. I.e.: there will be <xp:panel> controls between the various <xp:checkbox> instances.
So if user selects say the first of three checkboxes the resulting Domino field will contain the value "false" if the "uncheckValue" property is left empty, since the last checkbox in line obviously overwrites the values of the previous ones. Only if users check the last box the field will contain a suitable value.
In "normal" html code the various checkboxes simply are connected using the "name" attribute. But in Xpages that attribute is already used and overwritten by the engine duplicating the dynamic control id.

问:除了破解"复选框的 onchange 事件将选中的值复制到隐藏字段控件之外,是否还有某种类型的原生"解决方案?

Q: is there some type of "native" solution apart from "hacking" the checkboxes' onchange events copying the checked values into a hidden field control?

推荐答案

有几种方法可以解决这个问题.对我来说,最简单的方法是将三个复选框绑定到三个单独的字段,然后计算底层表单上需要包含适当值的字段.

There are a couple ways you can go about this. For me, the easiest is to bind the three checkboxes to three separate fields, then compute the field on the underlying form that needs to contain the appropriate value.

您可以通过几种方式计算它:- 打开计算保存在文档数据源上- 在文档保存期间在您的业务逻辑中手动计算

You can compute it a few ways: - Turn on compute on save on the document data source - Compute it manually in your business logic during the document save

我更喜欢这种方法的原因是确保打开文档时复选框包含正确的值.

The reason why I prefer this method is to make sure the checkboxes contain the correct value when the document is being opened.

这篇关于我们可以将多个复选框控件绑定到单个 Domino 数据字段吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆