Can we bind multiple checkBox controls to a single Domino data field?

懵懂的女人 提交于 2019-12-11 11:38:30

问题


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.

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


回答1:


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.



来源:https://stackoverflow.com/questions/35700091/can-we-bind-multiple-checkbox-controls-to-a-single-domino-data-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!