|
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
1) XPages: how to have multiple submit buttons for multiple data sources on the same page?
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?
good idea, thanks! 3) XPages: how to have multiple submit buttons for multiple data sources on the same page?
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. |
