Is it normal for the "saveDocument" Xpage action to stay in edit mode?

  • I have an XPage built from custom controls. The main page has the datasource, one CC renders the form, and another renders the navigator associated with that form. The Action buttons are on the navigator, and one of them is the POX (plain old xpage):

<xp:panel styleClass=“lotusBtnContainer” style=“margin:2px 10px”>

<xp:link escape="true" text="Save and Exit" id="Save" rendered="#{javascript:Ticket.isEditable();}" outerStyleClass="lotusBtn lotusBtnAction">

	<xp:eventHandler event="onclick" submit="true" refreshMode="complete">

		<xp:this.action><xp:saveDocument/></xp:this.action>

	</xp:eventHandler>

</xp:link>

</xp:panel>

which of course says “Save and Exit” in a pretty little button-looking link.

  • I also have print() statements in the various dataSource events to see when they fire, and what “Ticket” is like in an event’s execution environment. Here’s what I get when I open a Ticket, edit it, then click “Save and Exit”:

HTTP JVM: qOD

HTTP JVM: pOD

HTTP JVM: - Opening ← Open in read mode

HTTP JVM: qOD

HTTP JVM: pOD

HTTP JVM: - Editing ← Clicked Edit button

HTTP JVM: qSD ← Running “saveDocument” action

HTTP JVM: - Editing ← Still in edit mode

HTTP JVM: pSD

HTTP JVM: - Editing ← Save is done

HTTP JVM: qOD ← Why does it reopen, post save?

HTTP JVM: pOD

HTTP JVM: - Editing ← And still in edit mode?

  • Searching the Forum for “saveDocument” yields six hit. Three are crashes. One is a remote install issue. One is Lothar asking how to do saves on the web that work with a RIM, and one is Luc having problems saving rich text. Luc’s save action on his button is identical to my save action on my link.

  • How does one save a document from a XPage and have it not return to edit mode? Check if it’s being saved in postSaveDocument and redirect it manually?

Thanks for your time…

Subject: Do a group action…

Combine save document and change document mode simple actions…

<xp:button value=“Save and Readmode” id=“button1”>

<xp:eventHandler event="onclick" submit="true"

	refreshMode="complete">

	<xp:this.action>



		<xp:actionGroup>

			<xp:saveDocument></xp:saveDocument>

			<xp:changeDocumentMode mode="readOnly"></xp:changeDocumentMode>

		</xp:actionGroup>

	</xp:this.action>

</xp:eventHandler>

</xp:button>

Subject: I thought that was the case…

  • I just found no references to it. Thanks!!..

Subject: Sadly this doesn’t work…

  • When I put in an action group and add changeDocumentMode, the document stays in edit mode after the save.- When I add a script block to the action group, it won’t build because a script block can’t be put in an action group.

  • If I take out the action group, so it’s just saveDocument, and put a “normal” print in the Agent to load an URL, it doesn’t work

  • However, if I take the print out of the Agent and stick context.redirectToHome() in the postDocumentSave() it works like a charm.

  • So it appears Agents can’t interact with the browser at all with XPages. The XPage has to fully save the document, then pass its noteID as a parameter document, and the Agent can’t output anything directly to the web page like it used to, not even a redirect. It’s possible one could output JSON on an asynchronous call, I haven’t tried that, but the decade-long web model of Agent use appears to be thoroughly dead.

  • I’m not saying that’s bad … or good. I’m simply saying that’s how it is, so someone else has the opportunity to say “no it’s not”, or “that’s right”. Nothing more…