Based on your code, your button is partial refreshing showHidePanel which is the inputText field ... your refresh needs to include both the inputText field and the panel you want to show or hide based on your rendered property. When you click the button, a partial refresh is executed and the form that contains the element you are partially refreshing is submitted to the server ... the life cycle is then processed, and during the invoke application phase your button code is executed, at this point, all data is assumed valid, and has been applied to the data model ... after that, the renderResponse phase executes, and the html generated for the id you specify for partial Refresh is sent back to and applied to the HTML in the document ...
All that being said, you are actually making this harder than it needs to be ... first bind showHidePanel to a viewScoped variable... such as viewScope.showHidePanel (add the attribute value="#{viewScope.showHidePanel}" to the xp:inputText tag) ... then move the inputText component inside outerPanel. Change the rendered property of the innerPanel to #{javascript:viewScope.get("showHidePanel") == "1"} then set the refreshId of the button's eventHandler to outerPanel ....it'll work then...
Like this:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:panel id="outerPanel">
<xp:inputText id="showHidePanel" defaultValue="1" value="#{viewScope.showHidePanel}"></xp:inputText>
<xp:panel id="innerPanel">
<xp:this.rendered><![CDATA[#{javascript:viewScope.get("showHidePanel") == "1";}]]></xp:this.rendered>
<xp:inputText id="inputText1"></xp:inputText> 
<xp:button value="Print Value" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="outerPanel">
</xp:eventHandler>
</xp:button>
</xp:panel>
</xp:panel>
</xp:view>
Can you tell me how can I get the value in edit box using partial refresh? |