使用 javascript/jQuery 在 oracle apex 中以编程方式禁用按钮

发布于 2024-09-10 23:20:10 字数 263 浏览 4 评论 0原文

我正在尝试以 ajax 化的方式禁用 Oracle Application Express (Apex v3) 中表单区域内的按钮。我正在使用 jQuery 来完成 ajax 部分。

   $('#P16_MYBUTTON').hide();

在渲染的页面上查看源代码时,我注意到该按钮没有 ID,尽管在 Apex 中我已经给了它一个名称。我扫描了其余的代码,发现其他元素确实有一个 ID。这种行为让我有些困惑。

有什么想法吗?

I'm trying to disable a button inside of a form region in Oracle Application Express (Apex v3) in an ajax-ified manner. I'm using jQuery to accomplish the ajax part.

   $('#P16_MYBUTTON').hide();

Doing a view source on the rendered page I noticed that the button doesn't have an ID even though in Apex I've given it a name. I scanned through the rest of the code and noticed that other elements do have an ID. This behavior is somewhat confusing to me.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我一向站在原地 2024-09-17 23:20:10

Apex 4.0 会自动为每个按钮分配一个 ID。在 Apex 3.x 中,您可以通过按钮的 Attributes 属性自行分配:

id="P16_MYBUTTON"

如果按钮是 HTML 按钮,则足以使其工作;如果按钮基于模板,那么您需要确保模板定义在适当的位置包含 #BUTTON_ATTRIBUTES# 替换字符串 - 例如:

<a class="myButton" href="#LINK#" #BUTTON_ATTRIBUTES#>#LABEL#</a>

Apex 4.0 does assign an ID to each button automatically. In Apex 3.x you can assign one yourself via the button's Attributes property:

id="P16_MYBUTTON"

If the button is an HTML button then that is sufficient to make it work; if the button is based on a template then you need to ensure that the template definition contains the #BUTTON_ATTRIBUTES# substitution string in an appropriate position - for example:

<a class="myButton" href="#LINK#" #BUTTON_ATTRIBUTES#>#LABEL#</a>
时光病人 2024-09-17 23:20:10

我不知道 Apex 如何进行渲染,但是,您可以使用另一个 JQuery 选择器来定位该按钮,例如,如果您知道该按钮的直接父级的 ID 或 html 标签名称,您可以使用如下所示的内容:

$('form > button:first').hide()

为了便于将来参考,请下载此参考卡:

http://refcardz.dzone.com/refcardz/jquery-选择器

I don't know how Apex does its rendering thing, however, you could use another JQuery selector to locate the button, for instance, if you know the ID or html tag name of the direct parent of this button you could use something like:

$('form > button:first').hide()

For future reference, download this refcard:

http://refcardz.dzone.com/refcardz/jquery-selectors

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文