I have a simple test page that I'm trying work through the sequence of events and how to handle a querySaveDocument failure.
As far as I can see the sequence of events is
- onclick of submit
- validation
- querySaveDocument
- save document
in the submit action I return 'success' but that happens regardless of whether the querySave returns true or false. Now what I want to do is if the querySave fails return tio the same document the same way as the validation does. So I believe that setting the return 'success' in the onclick event is what is causing the problem but how do I trap the querySaveDocument and if it fails just return otherwise do the 'success' navigation.
This should not be that difficult but I think it is because the querySaveDocument is a backend event. But I would think that this sort of process would be something that people would do pretty regularly. I want to do the querySave after the validation because there is no point in attempting to do a rather involved querySaveDocument event only if the document is ready to be saved. I thought of doing the submit button return in an onComplete event but that does not appear to work. ??
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.navigationRules>
<xp:navigationRule outcome="success" viewId="xpMain.xsp">
</xp:navigationRule>
</xp:this.navigationRules>
<xp:button value="Submit" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" immediate="false" save="true">
<xp:this.action><![CDATA[#{javascript:println("In Submit")
return 'success';}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:br></xp:br>
<xp:br></xp:br>
Required Field 
<xp:inputText id="inputText1" value="#{document1.BusinessUnit}">
<xp:this.validators>
<xp:validateRequired message="Please enter a value"></xp:validateRequired>
</xp:this.validators>
<xp:this.required><![CDATA[#{javascript:println("In Validation");
return "This is a requiedd Field";}]]>
</xp:this.required>
</xp:inputText>
<xp:this.data>
<xp:dominoDocument databaseName="Client Apps\LGI\LGI Rules.nsf"
formName="frmCLRule" var="document1">
<xp:this.querySaveDocument>
<![CDATA[#{javascript:println("In QuerySave");
return false;}]]>
</xp:this.querySaveDocument>
</xp:dominoDocument>
</xp:this.data>
<xp:br></xp:br>
<xp:br></xp:br>
</xp:view>