以编程方式获取 XPage 按钮的 clientId [英] Getting the clientId of an XPages button programmatically

查看:19
本文介绍了以编程方式获取 XPage 按钮的 clientId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在表单上创建提交按钮时,HTML 中会生成以下内容

When I create a submit button on the form the following is generated in the HTML

XSP.attachEvent("view:_id1:_id2:_id38:_id55", 
    "view:_id1:_id2:_id38:button1", "onclick", null, true, 2);
});

"view:_id1:_id2:_id38:_id55" = eventHandler 的 clientId

"view:_id1:_id2:_id38:_id55" = the clientId of the eventHandler

"view:_id1:_id2:_id38:button1" = 按钮 clientID(一点也不混淆)

"view:_id1:_id2:_id38:button1" = the button clientID (not at all confusing)

就像我喜欢便携式命令指南一样 - 我无法确定如何以编程方式获取 eventHandler clientId.

Much as I love the Portable Command Guide - I am unable to determine how I can programmatically get the eventHandler clientId.

我需要使用 $$xspsubmitid 字段值通过 ajax 提交表单的 clientID

I need the clientID to submit the form via ajax using the $$xspsubmitid field value

这可以通过人脸完成吗?和 SSJS?

Can this be done through faces? and SSJS?

推荐答案

深入了解您想要做什么,我想看看我以前写的这篇文章会让您更深入地了解正在发生的事情.您尝试获取的 ID,clientId,而不是 targetClientId,是事件处理程序的 id,您可以通过为其分配 id 来获取,例如:

Reading deeper into what you want to do, I think taking a look at this article I wrote sometime back will give you deeper understanding of what is going on. The ID you are attempting to get, the clientId, rather than the targetClientId, is the id of the event handler, which you can get by assigning an id to, for example:

<xp:eventHandler id="foo">

这将强制运行时使用指定的 ID 而不是自动生成的 ID,从而允许您处理它.

that will force the runtime to use the specified ID rather than an auto-generated one, allowing you to get a handle on it.

这篇关于以编程方式获取 XPage 按钮的 clientId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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