Hi,
My SSJS is misbehaving.
Here’s a simple test case XPage with a button.
<?xml version="1.0" encoding="UTF-8"?><xp:view xmlns:xp=“http://www.ibm.com/xsp/core”>
<xp:table>
<xp:tr>
<xp:td>
<xp:label value="User i d:" id="userID_Label1" for="userID1">
</xp:label>
</xp:td>
<xp:td>
<xp:inputText id="userID1"></xp:inputText>
</xp:td>
</xp:tr>
</xp:table>
<xp:br></xp:br>
<xp:button value="Create Document" id="CreateDocument">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:var db = session.getCurrentDatabase();
var doc = db.createDocument();
var compUserID = getComponent(“userID1”);
var userID = compUserID.value;
doc.replaceItemValue(“Form”, “Test”);
doc.replaceItemValue(“Username”, userID);
doc.save();
}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
Presented in IE, or Firefox, the xpage sometimes works as desired. Sometimes, however, pressing the button clears the fields, and otherwise does nothing I can see. The SSJS doesn’t run, and no error is returned, or entered in the server log.
Over a short period of time, this problem occurs at regular intervals, but otherwise seems random. At present, for example, it will work for five presses, and then on the 6th it will clear the Xpage. Some of the XPages I have created have had cycles of 5-10 failed presses followed by a single success.
Why? Please help…