Daniele Grillo
Daniele Grillo

Reputation: 1023

autosave function in Ajax mode

I would realize a custom control for every XPages with a Notes Document Datasouces that have autosave funcionality (like google mail)

So that the event-handler is with "no validation"...

My question is...how execute this handler in Ajax Mode..so that the user don't refresh the current page?

Have someone any idea?

Upvotes: 2

Views: 852

Answers (1)

Sven Hasselbach
Sven Hasselbach

Reputation: 10485

Yes, you can use the good old CSJS executeOnServer method for this. The method can be found here: http://xpages.info/XPagesHome.nsf/Entry.xsp?documentId=88065536729EA065852578CB0066ADEC

To disable the validation you have to add the parameter valmode=0 to the partial refresh. This disables validators AND converters.

This is how the event handler should look like:

<xp:eventHandler event="autoSaveEvent" id="autoSaveDoc" submit="false">
   <xp:this.action>
      <xp:saveDocument />
   </xp:this.action>
</xp:eventHandler>

The event handler can now be called from CSJS with this code:

executeOnServer('autoSaveDoc',null,{ 'valmode': 0 })

Upvotes: 2

Related Questions