editing a document, saves as a new document - xpages

From a dynamic view controller, click link to EDIT a document, when I submit it creates a NEW document, not simply updating the one I clicked. What setting could I have set wrong? The URL even says "editdocument" when editing the view.

Verify your data source properties on the XPage used when opening/editing the document.

Related

How to change xpage form for new document?

Right now I am working on a Xpage which displays data from a domino document. Based on the form of the document different fields will be displayed.
Now I want to create a "New" function. My idea here is to set the view I am previously using in edit mode.
Additionally, I want to add a radio button which enables a user to choose the form of the document he wants to create.
Based on this radio button the document form should change which should result in the elements displayed on the page changing too.
Overall if I switch between the radio button options and hit save, a new document will be created with the right form.
Yet my problem is that my elements in my view won't change dynamically. So if I switch my form there will still be elements/controls displayed for the default option but not the selected form.
My idea was to create an onChange-event for my Radio Button Group.
My questions here would be: How can I change my formValue for the Xpage (new document) and then reload it with the new set value?
Thanks for your explanation.
I understand you have one XPage suitable for multiple forms, I assume using a Switch control and custom controls per form. About the New button, you could try first to have 3 New buttons, each for a separate form, and you create a URL like yoursite.com/xpage.xsp?action=newdocument&form=someform
When the user clicks the button, your page can read the parameters (param.action and param.form) and act accordingly. Or do you intend to update the current page using partial refresh, as a single page approach?

Why is the wrong form opening when I click the doc link I created from a SSJS function?

Ok, this is weird. I created an xpage input form. After the form is filled out, a document is created. I then create an email to notify people that the document has been created. I drop a doclink to the newly created document in the body of the email. During testing, I noticed that when I click the link in the email, the wrong Notes Form is opened. Instead of the 'TrainingRequest' form displaying the fields, the form 'Feedback' opens up instead. Here's what I checked:
- On the xpage data section, the 'form' is set to 'TrainingRequest'.
- When I open the document via the doc link, the field 'form' has the value 'TrainingRequest', which is correct. Yet it's displaying the 'Feedback' form.
- When I check the other field properties of the document, all the correct fields from the 'TrainingRequest' form are there and populated correctly.
- When I open the document via the view, the correct Notes form 'TrainingRequest' opens.
- There is no default form in the database design.
Has anyone seen this before?
thanks
clem
Doc links are always created using the default view of your application. If there is a form formula in this view then this overrides the form in the document. Remove the form formula of the default view and it works.
I almost NEVER use form formulas in my application because of the side effects.
Source code would be useful. But initial best guess based on what you're saying is you have two datasources on the XPage, neither have ignoreRequestParams set, so you're editing the same document with both data sources. ignoreRequestParams missing will ignore any properties you define.

Refreshing the xpage document & showing the computed fields immediately without closing & reopening the xpage document

I am working with xpages and need a unique number to be generated for each document. After saving the document, I want the user to be on the same page viewing the generated number. For this I have used the a action group on the submit button - 1) first action is a simple action which is saving the document. 2) Next action is script editor where I am calling my number generation agent 3) The last one is a simple action which is changing the current document mode from Edit to Read so that the user is still on the same xpage document after saving. But I see that the document is saved properly and also changed to read mode but I cant see the number generated. But if I close the document & open it again I see that the number is generated. I want this number to be shown without closing & reopening the document. Any help is appreciated.
If you're updating the backend Document datasource, you'll need to either fully reload the page or close and re-open. Try setting the unique reference on the dominoDocument datasource and re-saving that. Alternatively, build the relevant URL to the XPage with the relevant documentId parameter and redirect accordingly.
You can put a Full Upload at your onClick event or a partial Upload.
With the partial Update will update just one element of your page, if your computed fields are inside this element they will be updated.
http://i.stack.imgur.com/g0DA7.png

Xpages File Upload Control does nothing

Background: One xpage bound to document1. On this xpages is a tabbed table contain several tabs. Each tab contains an panel bound to other data sources incl document2. Document2 is created and made a child of document1. In each panel is a table to allow the user to create the new document, as well as two view controls. Everything works beautifully...until...
Problem: I was asked to add a way to upload an attachment to the child document. I first created an rich text field on the bound document called "ScannedInvoice". I then create a File Upload Control from the core controls and bound it to document2/ScannedInvoice. By rule, I only want a single attachment, otherwise I would consider the openNTF upload control.
I cannot figure out why nothing appears on the back end when I upload a file and create a new document. Everything else works, but there is no attachment in the ScannedInvoice field and also no $FILE fields attached to the document either.
Thanks in advance for any tips. I have searched quite a bit and have not found any answers. - Steve
<xp:fileUpload id="fileUpload1"
value="#{document2.ScannedInvoice}" useUploadname="false"
style="font-size:8pt" filename="scannedinvoice.jpg"
mimetype="image/jpeg">
</xp:fileUpload>
Note: The field ScannedInvoice on the Invoice form is rich text.
Code to save button: document2.save()
Document2 has scope=request and ignoreRequestParam=true. Both of these have to be set like this in order to work. parentID=# document1.getNoteID()
a file upload needs a full refresh of the page to be able to upload the file. Make sure that you are doing that.
======================================
Update Domino 9.0.1 supports partial refresh uploads

Multiple data sources in XPages

I have 2 xpages that interact together. The first acts as a homepage and allows the user to create a new document and fill out some basic header information. The button to create the new document, sets a sessionScope var with the NoteID. It then saves document1 and opens the same document using another xpage.
The second xpages is bound to document1, and uses the sessionScope to edit the document. This xpages contains and editPanel bound to document2. I want to create a child document to document2. This works but what happens is document1 is also saved as conflict. It is also saved as a second main document.
I DO NOT want to save document1 at all, but can't seem to prevent it. The button that creates document2 uses the simple action save document, and specfies document2.
HELP, I have tried everything, and have been stuck on this for 2 days.
Thanks!
Steve
To bind to multiple datasources, on your XPage, under Properties expand Data and set "Ignore Request Params" to TRUE
If you change the type of your buttons, to a simple button instead of a submit button, and handle the doc.save() yourself should solve your problem.
The Save Document simple action accepts the name of the data source to save as a String argument. If supplied, it will only save that specific data source.

Resources