简体   繁体   English

在JavaScript中禁用PrimeFaces selectOneMenu组件

[英]Disabling PrimeFaces selectOneMenu component in JavaScript

How to disable selectOneMenu 如何禁用selectOneMenu

If I add this in < p:calendar> tag onclick="document.getElementById('formId:textInputId').disabled=true" 如果我在<p:calendar>标记中添加onclick="document.getElementById('formId:textInputId').disabled=true"

it will disable < p:inputText with given ID, but if I try to do the same for < p:selectOneMenu> it will not work? 它会禁用具有给定ID的<p:inputText,但是如果我尝试对<p:selectOneMenu>进行相同操作,它将无法正常工作?

I have locked for id names on html page in same way as I did for inputText. 我已经以与输入文本相同的方式锁定了HTML页面上的ID名称。 it looks something like this j_idt13:projectName 它看起来像这样j_idt13:projectName

If you wand to disable the component from javascript, use Client Side API's disable() and enable() functions. 如果您想通过javascript禁用该组件,请使用客户端API的disable()enable()函数。

<p:selectOnceMenu widgetVar="selectOneMenuWidget" />

And From Javascript you can call: 从Java语言中,您可以调用:

PF('selectOneMenuWidget').disable();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM