My question looks weird as it is something that we are doing in Lotus Notes since ever but i cannot reproduce it with Xpages …
It is a little basic but there it is …
I try to “hide-when” a panel based on a radio button selection OR through a button ( this one works ). I do it by changing a sessionScope variable ( See below ). Doing it this way, I got a message of error saying something like “Unable to execute the set value simple action because not allowed to set the value of a read only computed expression” … What is wrong in my code ? It must be basic but i don’t find it … If you try the example below, the button works but not the radio button ( I want to make sure that if i select one radio button, i see the panel and if i choose the second one, i don’t see it … like the button is doing ). Very basic with a normal Notes app but there is something i am missing with the Xpages …
Thanks.
<?xml version="1.0" encoding="UTF-8"?><xp:view xmlns:xp=“http://www.ibm.com/xsp/core”>
<xp:this.data>
<xp:dominoDocument var="dominoDocument1"
formName="SiteProfile">
</xp:dominoDocument>
</xp:this.data>
<xp:panel id="panel2Refresh">
<xp:button value="Show and Hide" id="button2">
<xp:eventHandler event="onclick" submit="false"
refreshMode="partial" refreshId="panel2Refresh">
<xp:this.action>
<xp:setValue binding="#{sessionScope.v01}">
<xp:this.value><![CDATA[#{javascript:var sh = sessionScope.get("v01");
if (sh ==“SHOW”){“HIDE”
}
else{“SHOW”
}}]]></xp:this.value>
</xp:setValue>
</xp:this.action></xp:eventHandler>
</xp:button>
<xp:radio text="Label1" id="radio1" groupName="group1"
value="#{dominoDocument1.Site}" selectedValue="true">
<xp:eventHandler event="onclick" submit="false"
refreshMode="partial" refreshId="panel2Refresh" immediate="true">
<xp:this.action><![CDATA[#{javascript:sessionScope.put("v01","SHOW")}]]></xp:this.action>
</xp:eventHandler>
</xp:radio>
<xp:radio text="Label2" id="radio2" groupName="group1" value="#{dominoDocument1.Site}" selectedValue="true">
<xp:eventHandler event="onclick" submit="false"
refreshMode="partial" refreshId="panel2Refresh">
</xp:eventHandler></xp:radio>
ww<xp:panel
style="width:443.0px;height:186.0px;text-align:center;border-color:rgb(0,128,255);border-style:solid;border-width:thin">
<xp:this.rendered><![CDATA[#{javascript:sessionScope.get("v01")=="SHOW"}]]></xp:this.rendered>
<xp:label value="PANEL" id="label1"
style="margin-top:30px;color:rgb(0,128,192);font-weight:bold;font-size:14pt">
</xp:label>
</xp:panel>
</xp:panel>
</xp:view>