【问题标题】:Xpages get component value in extlib dialog boxXpages 在 extlib 对话框中获取组件值
【发布时间】:2012-12-26 16:10:47
【问题描述】:

我在 extlib 对话框的面板中定义了一个文档数据源(称为 document1)。在此面板中,它包含对话框内容和对话框按钮栏。在对话框内容中,包含一个自定义控件,该控件具有所有组件,例如 dojo 编辑框、列表框、单选按钮等。在对话框按钮栏中,它包含一个保存按钮。保存时,我无法通过以下getComponent,document.getDocument.getxxx从任何组件中获取值:

 print (getComponent.getValue("control"));
 print (document1.getDocument(true).getValueInString("control"));
 print (document1.getValue("control"));

有趣的是,document1.sertValue("control", newvalue) 和 document1.getDocument(true).isNewNote() 都在工作。

对话框从重复中的视图列打开。所有数据都正确显示在对话框中。我可以保存修改后的数据,检索它们并毫无问题地显示它们。唯一我无法获得它们的值进行处理。

Save 事件处理程序已完全更新,并为面板设置了部分执行模式

面板忽略其参数并将范围设置为请求但没有运气。

非常感谢您的帮助。提前致谢。

【问题讨论】:

  • 其实 document1.getDocument().getXXX('name of the item') 和 document1.getValue("name of the item") 他们的参数应该是物品的名字,而不是控制ID!! !它们是可行的:-)。但是,getComponent.getValue("control") 仍然没有运气。
  • 不应该“打印 (getComponent.getValue("control"));”改为"print(getComponent("control").getValue();"?
  • 啊,你说得对,弗兰蒂塞克。它是 getComponent("control").getValue() :-)
  • 对不起,我弄错了。我实际上做了 getComponent('controlId').getValue() 并再试一次,但仍然没有运气。只是想知道是不是因为 extlib 对话框中的控制。
  • 刚刚发现getComponent('controlId').getValue()对extlib控件不起作用,即

标签: xpages xpages-ssjs xpages-extlib


【解决方案1】:

您需要考虑和/或检查许多事项:

  • 确保您确实掌握了该控件。由于它位于自定义控件中,因此您可以轻松拥有多个控件。在这种情况下,您要么需要自己的函数getComponentChild(parentName,controlName) or (IMHO better) you read it from the compositeData of the customControl (which is a MAP)
  • 当你绑定一个控件时,进行它的绑定比使用getValue() 更容易。因此,当您绑定到 document.subject 时,请查找该值(或 viewScope.someValue,如果您将其绑定到 viewScope)
  • 如果提交验证失败或您在较早阶段查询,则不能使用getValue(),但需要使用 getSubmittedValue(),因为它包含验证发生之前的原始值

告诉我们进展如何

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多