Sie können mich buchen für:
Individuelle Schulungen für XPages, JavaScript und Appcelerator Titanium Software-Entwicklung für IBM XPages, Appcelerator Titanium (Mobile Apps iPhone, iPad, Android, Blackberry 10), Mobile Web und IBM Notes
XPages: how to have multiple submit buttons for multiple data sources on the same page?
Julian Buss, May 26th, 2009 15:03:55
Tags:  XPages 
I came across the following problem, perhaps someone has an idea?

I have a XPage with two document data sources. Field A is bound to the first source, field B to the second.

Beside field A I want to have a button "save", and beside field B, too. When the user hits the first button, ONLY the first data source should be saved. When the user hits the other button, ONLY the other data source should be saved.

When both buttons are submit buttons, then always both sources are saved, resulting in an "empty" document for the other data source. When both buttons are standard buttons and I write a onclick handler with datasource.save(), I can save the sources individually.

BUT: after saving I want NEW documents to be created, so that the next button click saves into a new document.

So what I miss is a "reset" or "create" method for the NotesXSPDocument. The only workaround I found so far is to reload the whole page using context.reload(). That works, but is not nice.

Any other hints?
Comments (3) | Permanent Link

Comments:
1) XPages: how to have multiple submit buttons for multiple data sources on the same page?
Paul T Calhoun 26.05.2009 19:19:24

In your button use the core domino java classes to create a new document from the values in the xpage fields using document.save() instead of datasource save.

Then each time the button is pressed a new document is created.

2) XPages: how to have multiple submit buttons for multiple data sources on the same page?
Julian Buss 26.05.2009 22:10:04

good idea, thanks!

3) XPages: how to have multiple submit buttons for multiple data sources on the same page?
Paul Withers 23.06.2009 16:33:22

From what I can see, it appears the "Save Data Sources" simple action only saves datasources from the custom control it's in and any child custom controls.

Perhaps it will work if you use two custom controls, one with datasource, field and button for datasource A; the other with datasource, field and button for datasource B. That way your buttons could use the simple action going back to the same XPage.

Add a comment
Subject:
   
Name:
Mail:
Web:
 
Comment:  (No HTML - URLs with leading http://)
 
remember me?   
You can hire me.
See my Linkedin profile for details.

Thanks for reading and have a nice time here!

Please note my Apps for iPhone and iPad: NotesBook: takes your Lotus Notes Notebook (Journal) to your iPhone and iPad xpageswiki.com: huge XPages Tips & Tricks collection for iPhone and iPad