XPage - Saving twice!?!

I have a Submit button on my XPage, which calls an Agent. Even before the agent was added to the list of actions, it saved the document twice…and still does.

I removed the agent and tried the button on its own (button type : submit) and it is doing the same.

It seems to save the document twice, Once with no data in the fields, apart from the created date and created by. The other document is fully populated with the required data.

Is there something i am doing wrong…?

Thanks

Subject: I have seen that before.

I have seen that once before. In my case I had more then on data source setup for the same form.

Subject: Are you using a custom control on the xpage?

Are you using a custom control on the xpage?

I’ve seen this when you use a custom control and have declared the same datasource on the cc as the xpage.

-John

Subject: ahhhh - of course!

thanks for that folks!

I am such an idiot! I had the data source defined twice, once on the XPage and another time on the XPage - hence the duplicate.

Thanks

Subject: Passing a DS to a CC

See John Mackey’s article on how to pass a DataSource from the XPage to Custom Controls:-

Subject: still have the same error.

hello John, i have a tabbed panel containing two custom controls, one in each panel. (I actally copied and pasted the custom control, and now i set two different names for the datasources).

I put some code ( replaceItemValue ) on the onclick event of the submit button.

Submitting the form keep creating two documents, one totally blank (except two fields) and the other properly set.

I tried using as Default action either “Create Document”, “Edit Document”, “Open Document”…

with no success…

I also tried to set the button as “Button” and manually save the document: it’s working fine, but the next submit replace the document saved earlier and instead, i want to create a new document.

I don’t know what is wrong…

Thaks for your time !

Marco