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.
My form has user details fields (ex: UserID, first name, last name ...) along with the three buttons to Add/Update/Delete the user.
First, a user ID should be entered. Thru ajax request i will try to get the details. 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 reques开发者_JAVA技巧ts.
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.
If i remove the disabled attribute from them, then all the three buttons work!!
<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.
精彩评论