将计算的 xpage 字段绑定到表单字段 [英] Binding computed xpage fields to a form field

查看:31
本文介绍了将计算的 xpage 字段绑定到表单字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多关于将数据绑定到表单的问题.这很简单.我有一个表单,它使用多个计算字段,这些字段使用 @DbLookup 提取数据,以根据用户选择的下拉菜单填充字段.问题是;没有任何计算字段将任何值保存到它所绑定的表单中.保存在表单上的唯一数据是手动选择(在下拉菜单的情况下)或手动输入的数据.当我使用编辑框并且不将其设为只读"时,数据保存良好.为什么这么难?

There is a lot of questions about binding data to forms. This is very simple. I have a form that uses several computed fields that pull data using an @DbLookup to populate the fields based on a pulldown menu the user selects. The problem is; none of the computed fields save any of the values into the form that it is bound to. The only data that saves on the form is the data that is manually selected (in the case of the pulldown menu) or manually entered. When I use an edit box and don't make it "Read Only" the data saves fine. Why is this so difficult?

推荐答案

像往常一样,Dave 引导我去做一些有效的事情.在 JavaScript 体验的幼年阶段,我相信有更好的方法来做到这一点.我很高兴它有效.她是我放入 Xpage 的 QuerySave 事件中的代码.

As usual, Dave steered me to something that worked. Being in the larval stages of JavaScript experience, I'm sure there is a better way to do this. I'm just happy it works. Her is the code I put into the QuerySave event of my Xpage.

var cost1 = getComponent('ItemCost1').getValue();
var uom1 = getComponent('UOM1').getValue();
var Num1 = getComponent('ItemNum1').getValue();
var tot1 = getComponent('Total1').getValue();

docuent1.replaceItemValue("ItemCost_1", cost1), 
document1.replaceItemValue("ItemUOM_1", uom1),
document1.replaceItemValue("ItemNum_1", Num1),
document1.replaceItemValue("CostTotal_1", tot1)

我有 30 次迭代,所以它可能有点笨拙,但操作词是 WORKS.如果有人有更好的方法来获得相同的结果,请发布它,以便我可以学到一些东西.感谢大家的帮助.

I have 30 iterations of this so it probably works kind of clunky but the operative word is WORKS. If anyone has a better way to get the same results, please post it so I can learn something. Thanks for everyone's help.

这篇关于将计算的 xpage 字段绑定到表单字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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