Im using a primefaces FieldSet component and have a button field specified inside the field set. I have a requirement, Where, when I click on the command button, a h:selectonemenu & an inputtext should be displayed and On further click, the h:selectOnemenu &inputtext should be hidden. Below is the code that I have written to show & hide. The show part works fine. But when I try to click on the button to hide, it does not work.
xhtml code
<h:panelGrid id="grid1" columns="3">
<p:fieldset id="GlobalAdjustment" legend="GlobalAdjustment" style="font-size:12px !important;width:30%" >
<h:commandButton id="globalAdjustID" image="#{review.imageUrl}" actionListener="#{review.showUpdateList}" />
</p:fieldset>
<h:selectOneMenu id="SelectID" value="#{review.reviewList}" rendered="#{demandReview.selectoneRenderer}">
<f:selectItems id="FilterSelectListID" value="#{review.reviewListIDs}" style="font-size:12px !important"></f:selectItems>
</h:selectOneMenu>
<h:inputText id="fieldUpdateID" required="false" rendered="#{review.inputTextRenderer}"></h:inputText>
</h:panelGrid>
ManagedBean ActionListener method
public void showUpdateList(ActionEvent event)
{
System.out.println("entering the Action Method:");
Map<String, Object> idMap = new HashMap<String, Object>() ;
idMap = event.getComponent().getAttributes();
String url = (String) idMap.get("image");
System.out.println("The url is :"+url);
if(url.equals("/images/add_data_button.png")){
//upbean.setImageUrl("/images/remove_data_button.png") ;
imageUrl ="/images/remove_data_button.png" ;
selectoneRenderer = true;
inputTextRenderer = true;
}else
{
imageUrl ="/images/add_data_button.png" ;
selectoneRenderer = false;
inputTextRenderer = false;
}
}
When I click the command button inside the fieldset for the first time, it works fine and displays the selectoneMenu & the textbox. Once further clicks, the ActionListener is not getting invoked. Please help me resolve the issue.
Thanks
h:messages
tag on your page to display errors? If not, add one to see what happens. – Matt Handy