I have added the following code to a new XPage and it works fine:
<xp:panel styleClass="DemoLeft" rendered="true">
<xp:table styleClass="DemoLeft">
<xp:tr>
<xp:td>
<xp:label value="First Name:" id="label1"></xp:label>
</xp:td>
<xp:td>
<xp:inputText id="FirstNameXY"></xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label value="Last Name:" id="label2"></xp:label>
</xp:td>
<xp:td>
<xp:inputText id="LastNameXY"></xp:inputText>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label value="Full Name:" id="label3"></xp:label>
<xp:span id="F"></xp:span>
</xp:td>
<xp:td>
<xp:inputText id="FullNameXY" readonly="true">
</xp:inputText>
</xp:td>
</xp:tr>
</xp:table>
</xp:panel>
<xp:panel styleClass="DemoLeft" rendered="true">
<xp:table styleClass="DemoLeft">
<xp:tr>
<xp:td>
<xp:button id="button3" value="Set Full Name">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="FullNameXY">
<xp:this.action><![CDATA[#{javascript:var fName = getComponent("FirstNameXY").getValue();
var lName = getComponent("LastNameXY").getValue();
var fullName = fName+" "+lName;
getComponent("FullNameXY").setValue(fullName);}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:td>
</xp:tr>
</xp:table>
</xp:panel>
However when I add the code to an existing XPage, it does not work at all - I click the button but nothing happens. What could be the problem here?