I have troubles with the XPages xp:fileDownload core control, running on a Domino 9.0.1 FP3 server. On a Domino 8.5.3 FP6 server I have no problems, it works perfect!
Here's the simple source code of the xpage:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.data>
<xp:dominoDocument var="document1" computeWithForm="onsave"
formName="Files" action="editDocument"
documentId="6E004D63CD737B79C1257E520050C14C">
</xp:dominoDocument>
</xp:this.data>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:fileUpload id="fileUpload1" value="#{document1.Body}"></xp:fileUpload>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:fileDownload rows="30" id="fileDownload1" displayLastModified="false"
value="#{document1.Body}" allowDelete="true">
</xp:fileDownload>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:button value="Save" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:saveDocument var="document1"></xp:saveDocument>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
Take a look at the following scenario:
Upload some files (using xp:fileUpload core control)
Delete a file and save the document (repeat this step)
After some repeats, I get the following notes exception
Remember: I have no troubles on Domino Server 8.5.3 FP6!
This may be caused by XPage persistence settings. The component tree is stored in memory / on disk and there are a maximum number of entries, set in XSP Properties. The amount of uploads / deletes may be meaning the original component tree is no longer available.
Check the persistence settings in the application / server. If this is the cause it will consistently fail after x refreshes on the same page.
One option is increasing. Alternatively, in 9.0.1 the file upload can be changed to run via a partial refresh, which may also resolve the problem.
Related
I created a user Guest with Depositor rights. He can also Read and Write Public Documents. The test document I created has a field $PublicAccess with value "1". To open the document in the Guest XPage using a browser, I use this URL:
https:://domain/database.nsf/Guest.xsp?documentId=E696&action=editDocument
The page opens, the Summary field is filled from the document with ID=E696, but it stays read-only. If I add a 2nd dominoDocument that creates a new document, that field is editable, and clicking the Save button will save the data.
Is it possible to allow a Depositor to modify a Public document?
Here's my simple XPage:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.data>
<xp:dominoDocument var="document1" formName="ABC"></xp:dominoDocument>
<xp:dominoDocument var="document2" formName="XYZ" ignoreRequestParams="true"></xp:dominoDocument>
</xp:this.data>
Summary
<xp:br></xp:br>
<xp:inputText id="inputText1" value="#{document1.Summary}"></xp:inputText>
<xp:br></xp:br>
Code
<xp:br></xp:br>
<xp:inputText id="inputText2" value="#{document2.Code}"></xp:inputText>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:button value="Save" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:saveDocument var="document2"></xp:saveDocument>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
What I found out is that the presence of any valid non-empty Authors field (e.g. with a name or a role) will block edit access for Anonymous or a Depositor. My "solution" is to change the Authors property, by using setAuthors(false) on every Authors field.
I hope you guys are doing good. I am using date and time control on front end for selection of Time from date and time control and only time is visible at front end. My users are using different timezone.
(UTC +09) Osaka, Singapore, Tokyo
(UTC +05) Tashkant
Now data stored in time field is different in binding field. How can I override field data using SSJS to keep all users in single timezone.
e.g. i want to using UTC +05 for all users having different zones.
Kindly let me know if you require any clarification about my question.
Thanks,
Qaiser
According to this info you can automaticaly convert date/time field to specific time zone natively.
Try this example:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.data>
<xp:dominoDocument
var="document1"
formName="FRM">
</xp:dominoDocument>
</xp:this.data>
<xp:label
value="UTC Tashkent:"
id="label1"
for="computedField1">
</xp:label>
<xp:inputText
id="inputText1"
value="#{document1.utc5}"
defaultValue="#{javascript:#Now()}">
<xp:this.converter>
<xp:convertDateTime
timeZone="Asia/Tashkent"
type="time"></xp:convertDateTime>
</xp:this.converter>
<xp:dateTimeHelper></xp:dateTimeHelper>
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="complete">
</xp:eventHandler>
</xp:inputText>
Your UTC: <xp:text
escape="true"
id="computedField1"
value="#{document1.utc5}">
<xp:this.converter>
<xp:convertDateTime
type="time"></xp:convertDateTime>
</xp:this.converter>
</xp:text>
<xp:br></xp:br>
<xp:button
value="Save"
id="button1">
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="complete">
<xp:this.action>
<xp:saveDocument
var="document1"></xp:saveDocument>
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
The page forces edit box to be shown in Tashkent time zone, regardless of browser's settings. Be aware, that stored value may be different, if server's time zone is different from the forced one.
I have a xpage, with multiple tabs. First tab contains a panel, whose content are editable only when isNewNote() is true. So I computed readonly attribute for the panel.
But everytime I save the document, it is creating a new conflict document.
At the sametime,if I uncheck read-only property, it is saving properly without any conflict.
Can anybody help me to solve this issue?
CODE - Xpage
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.data>
<xp:dominoDocument var="document1"
formName="frmOnboardingRequest">
</xp:dominoDocument>
</xp:this.data>
<xp:panel>
<xp:this.readonly><![CDATA[#{javascript:if(document1.isNewNote()){
return false;
}else{
return true;
}}]]></xp:this.readonly>
<xp:table>
<xp:tr>
<xp:td>
<xp:label value="O n_ e d_ form completed by:"
id="oN_ED_FormCompletedBy_Label1" for="oN_ED_FormCompletedBy1">
</xp:label>
</xp:td>
<xp:td>
<xp:inputText
value="#{document1.ON_ED_EmployeeName}"
id="oN_ED_FormCompletedBy1">
</xp:inputText>
</xp:td>
</xp:tr>
</xp:table></xp:panel>
<xp:button value="Submit" id="button1"><xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="true"></xp:eventHandler></xp:button></xp:view>
Check for multiple datasources pointing to the same document.
Some posts before with the same problem
xpage creates save conflict on save/submit
Multiple data sources in XPages
Lotus Notes: Replication conflict caused by agent and user running on the document at same time
=================================================
Edit
I had to change the button code to this to get the same problem
<xp:button value="Submit" id="button1"><xp:eventHandler event="onclick" refreshMode="complete" submit="true">
<xp:this.action>
<xp:saveDocument></xp:saveDocument>
</xp:this.action></xp:eventHandler></xp:button>
After some more testing, try this.
Add this field to the end of the xpage
<xp:inputText id="inputText1"
value="#{document1.temp}"
style="visibility:hidden;display:none">
</xp:inputText>
Then no conflicts are created.
Strange indeed - but also not. Your data source is bound to the page and not to the panel. So if you want to set read mode only for that panel, consider to calculate the panel's datasource from the page's datasource:
<xp:panel>
<xp:this.data>
<xp:dominoDocument var="document1" action="openDocument"></xp:dominoDocument>
</xp:this.data>
</xp:panel>
Of course you have to calculate the document mode and the docid instead of using the readonly property.
In addition to the other suggestions, when working with tabbed tables you will want to follow this blog post carefully. I have been through similar issues on a previous project and Tommy Valand's redirectToCurrentDocument() fixed them.
http://dontpanic82.blogspot.com/2010/06/xpages-avoid-saving-duplicate-documents.html
I have a submit button on top that's normally doing a partial refresh of the form.
When I added a fileUpload control that won't due, as I need to do a full refresh. But I only wish this to happen if the user has added a file to be uploaded. So if the file Upload is empty I want to use a partialRefresh to submit.
I can check if a file is added easily enough and I could have two buttons with different refresh modes and hide them using JS, but that's a clunky solution.
What I would like to do is change the refresh mode on the submit button depending on a submitted value in the current form.
Any ideas?
Thanks!
/J
You can do this by adding a second event handler to your button: One event handler is for a full refresh, the other one for the partial refresh.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:div id="divRefresh">
<xp:label value="#{javascript:java.lang.System.currentTimeMillis()}" id="label1" />
<xp:label value="#{javascript:java.lang.System.currentTimeMillis()}" id="label2" />
</xp:div>
<xp:br></xp:br>
<xp:button value="Refresh" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.script>
<![CDATA[alert("Complete!"); return false;]]>
</xp:this.script>
</xp:eventHandler>
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="label2">
<xp:this.script>
<![CDATA[alert("Partial!");return true;]]>
</xp:this.script>
</xp:eventHandler>
</xp:button>
</xp:view>
The CSJS code in the events has to return false to stop the event.
I do this in http://www.intrapages.com when posting new stream content.
in the onchange event for the upload control I set a requestScope variable. and if that is set I perform a full refresh. works great
I have a check box that is disabled. I click a button that sets the value of that check box to be 'checked'. When I go to save, the check box loses its value. Anyone have any ideas? Here is a simple mockup:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.data>
<xp:dominoDocument
var="MainForm"
formName="MainForm" />
</xp:this.data>
<xp:checkBox
text="CheckBox"
id="CheckBox"
value="#{MainForm.CheckBox}"
disabled="true"
checkedValue="Y"
uncheckedValue="N">
</xp:checkBox>
<xp:br></xp:br>
<xp:button
id="setBc"
value="Set CheckBox">
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="partial"
refreshId="CheckBox">
<xp:this.action><![CDATA[#{javascript:getComponent("CheckBox").setValue("Y");}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button
value="Save"
id="button5">
<xp:eventHandler
event="onclick"
submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:MainForm.save();}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
Disabled controls are not included in page submissions.
You can combine your disabled check box with a xp:inputHidden control which is a hidden input field that is included in page submissions.
This could be a specific problem to Domino 8.5.3 (if that is what you are using).
We have noticed that since we upgraded to 8.5.3 we get a problem (on normal classic domino pages) where fields tagged as "disabled" don't get saved down to the doc.
We have had to build around this by not using a "proper" field that is disabled for values that has to later be saved.
Another workaround was to remove the disabled setting before posting in the post script.
We are fairly sure this all started to happened with the release of 8.5.3