简体   繁体   English

Richfaces a4j:在 ajax 响应后启用时,commandButton 不起作用

[英]Richfaces a4j:commandButton not working when enabled after a ajax response

I have richfaces page thru which i have to add/update/delete a user details.我有richfaces 页面,我必须添加/更新/删除用户详细信息。

My form has user details fields (ex: UserID, first name, last name...) along with the three buttons to Add/Update/Delete the user.我的表单具有用户详细信息字段(例如:用户 ID、名字、姓氏...)以及用于添加/更新/删除用户的三个按钮。

First, a user ID should be entered.首先,应输入用户 ID。 Thru ajax request i will try to get the details.通过 ajax 请求,我将尝试获取详细信息。 If user exist, update and delete buttons will be enabled.如果用户存在,将启用更新和删除按钮。 Otherwise, add button will be enabled.否则,将启用添加按钮。 The details need to be manually inputted and submitted thru add button.详细信息需要手动输入并通过添加按钮提交。 All three buttons are ajax requests.所有三个按钮都是 ajax 请求。

After Get Details is clicked, the buttons do get enabled properly as per the conditions, but when i click them, nothing happens.单击“获取详细信息”后,这些按钮会根据条件正确启用,但是当我单击它们时,什么也没有发生。 I see that a Ajax request is being sent but not to the action method and a blank response is received.我看到正在发送 Ajax 请求,但未发送到操作方法,并且收到了空白响应。

If i remove the disabled attribute from them, then all the three buttons work!!如果我从它们中删除 disabled 属性,那么所有三个按钮都可以工作!

<a4j:form>
<rich:panel id="UserManagePanel">
    <h:outputText value="User ID: "/>
    <a4j:region>
        <h:inputText id="userId" size="26" value="#{addUser.userName}" required="true" />
        <a4j:commandLink action="#{adminManager.getUserDetails()}" reRender="UserManagePanel" value="Get Details" />
    </a4j:region>
    <h:outputText value="First Name:" />
    <h:inputText value="#{addUser.firstName}" required="true" />
    <h:outputText value="Last Name: " />
    <h:inputText value="#{addUser.lastName}" required="true" />
    <h:outputText value="Email: " />
    <h:inputText value="#{addUser.emailId}" required="true" />
    <a4j:commandButton value="Add" reRender="messageArea" action="#{adminManager.saveUser()}" disabled="#{addUser.userExists}"/>
    <a4j:commandButton value="Modify" reRender="messageArea" action="#{adminManager.updateUser()}" disabled="#{!addUser.userExists}"/>
    <a4j:commandButton value="Delete" reRender="messageArea" action="#{adminManager.deleteUser()}" disabled="#{!addUser.userExists}"/>
</rich:panel>

Any idea what I am doing wrong here?知道我在这里做错了什么吗?

Make sure disabled evaluates to 'false' when you click the button.确保单击按钮时禁用的评估结果为“假”。

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

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