我想专注于我的RichFaces rich:modalPanel
中的第一个h:inputSecret
组件。我读过我需要使用下面列表中包含的JavaScript,但它不起作用(Win FF)。谁能告诉我为什么不呢?我已经尝试了id =“Form”的自动聚焦,并给了panelGrid一个id,并使用它无济于事。任何帮助赞赏。如何在JSF XML中嵌入jQuery/javascript
<rich:modalPanel id="PwdPanel" autosized="true" width="300" onshow="autofocus('FormNewP0')">
<a4j:region id="FormCont">
<a4j:form name="Form">
<h:panelGrid columns="2" style="padding: 2px;">
<h:outputText value="New password " />
<h:inputSecret id="FormNewP0"
value="#{MyBacking.dbNewPwd0}" />
<h:outputText value="Re-enter new password " />
<h:inputSecret id="FormNewP1"
value="#{MyBacking.dbNewPwd1}" />
<h:outputText value="" />
<h:panelGroup>
<a4j:commandButton value="Submit"
action="#{MyBacking.dbPwdChange}"
oncomplete="#{MyBacking.dbPwdError == true ? 'Richfaces.showModalPanel(\'ErrorPanel\');' : 'Richfaces.hideModalPanel(\'ErrorPanel\');Richfaces.hideModalPanel(\'PwdPanel\');'}"
reRender="FormCont,FormText" />
<h:outputText value=" " />
<a4j:commandButton value="Cancel"
onclick="#{rich:component('PwdPanel')}.hide();return false;" />
</h:panelGroup>
</h:panelGrid>
</a4j:form>
</a4j:region>
</rich:modalPanel>
<script type="text/javascript" language="JavaScript">
function autofocus(containerId) {
var element = jQuery(":input:not(:button):visible:enabled:first", '#'+containerId);
if (element != null) {
element.focus().select();
}
}
</script>
服务器端源代码与故事无关,因为JavaScript没有看到它的任何一行。客户端源代码更感兴趣,因为这是JavaScript可以查看和访问的唯一源代码。在浏览器中右键单击页面,然后选择*查看源代码*。顺便说一下,你对我的其他回答在描述与你相同的症状的问题上的赞成有点愚蠢,因为你没有**相同的问题**。 – BalusC 2010-05-20 13:56:04
嗯,我正在处理几个类似的问题,所以它可能是一样的。或者它可能是一个错误。 – volvox 2010-05-20 15:41:09