I'm using several Edit Boxes on an XPage. These Edit Boxes use the display type Date/Time and are designed to store and display date values. On my test server these Edit Box fields contain no default value when a new XPage is being created. On my production server the current date is always displayed as a default value. What could be the cause of this? Here is my code:
<xp:inputText id="Birthdate" value="#{document1.Birthdate}" defaultValue="">
<xp:this.converter>
<xp:convertDateTime type="date"></xp:convertDateTime></xp:this.converter>
<xp:dateTimeHelper></xp:dateTimeHelper>
</xp:inputText>
This is a change in Domino 9 but it has been changed in 9.01
Check this previous question about this and the solution
Xpages Date Time Picker field defaults to today's date
Related
I have a numeric field which has multivalue. I set values of numeric field in backend. I try to show values line by line in a Dojo Text Area. But my problem starts here. When open document in edit Mode. djTextBox adds "." and one decimal place (Zero "0") (added screenshot below). How can i make it to show only the original value of field without adding any dot(".") or Zero("0"). If it not possible I can change the way it did.
<xe:djTextarea id="CountHID" value="#{document1.CountH}" multipleSeparator="#{javascript:#NewLine();}">
<xe:this.converter>
When stored / edited by default in XPages numbers are Doubles. So because a Double includes decimal content, that's why the decimal is showing. You need to set the display type to Number and Integer Only (on Data tab of the Properties pretty panel).
Source pane XML markup for this is:
<xp:this.converter>
<xp:convertNumber type="number" integerOnly="true"></xp:convertNumber>
</xp:this.converter>
I'm trying to add the following value to a computed field:
var b = #Subset(#Unique(#DbColumn (#DbName(),"vwNrRegistru",1)),-1);
if (#Elements(b)<1){return 10001; }
else { return (b+1);}
But, I want the computed field to be binded to a datasource field:
<xp:text escape="true" id="computedField1" value="#{Contr.txt_nrcontractcv}">
I would use an inputText, but everytime I open the doc. for editing, the value increments, that's the reason I would like to go for a computed field. How can I achieve this?
You want to take the value from an existing Notes field, then do some calculation on that, then display the result, right?
You might want to bind your comp. field to a scoped var. Then do the basic calculation beforePageLoad and put the result into the scoped var. You can easily control when the calculation takes place, e.g. only for new docs, or on specific times of day or whatever
Create a inputText with style="display:none;", so that it is always rendered*, but never shown on the screen and a 'computed field' (text) that simply is equal to the value of the non-displayed field.
when they chose to label the value in properties as "Visible" they made a mistake. They really ought to have called it "Rendered" in the properties. It might also have been useful for them to have a "Displayed" property to allow you to control the display style, but that would have been mixing too many things.
I have a repeat control that is gathering its data from a view. Displaying in a table is one column from the view. These entries can be variable. For each entry in the repeat control I would like to have a couple of user editable fields (comments and checkboxes). Since the amount and names of entries are dynamic I think dynamic field binding is the way to go. The problem is I have been struggling with it for a few days and have gotten no where.
So in the repeat I have a computedfield displying the value of the column. I was thinking of making the field name for the comments field the value of the computedfield. The datasource would be the same, just the fieldnames would change and be based on the entries in the row.
The previous entries stackoverflow entries about dynamic field binding all list passing custom properties, I still haven't gotten my head around those.
If the value of the computedfield1 = "One" then the datasource/field name for the inputText1 = "document1.One", and if the computedField1 = "Two" then the datasource inputText1 = "document1.Two"
Is this even possible?
I'm a little confused by if you want these to be things you're setting to render at page load or if you want them to dynamically change based on user entered data, but I'll assume it's the former and give you an example.
If I'm iterating through a view in a repeat control, I probably have something like:
<xp:repeat rows="50" var="currRow" value="#{ViewName}" IndexVar="rowNum">
</xp:repeat>
Inside my repeat, I will put a reference to a custom class
<xp:repeat rows="50" var="currRow" value="#{ViewName}" IndexVar="rowNum">
<xc:dynamicRowBinding dataSource="#{currentDocument}">
<xc:this.binding1>
<![CDATA[#{javascript: currRow.getColumnValue("binding1");}]]>
</xc:this.binding1>
</xc:dynamicRowBinding>
</xp:repeat>
What this is assuming is that the document you're binding things to on the XPage is declared as currentDocument, and that there is a column in your underlying view that is calculating the desired field binding for the current row based on the properties and values of that document.
In the custom control, the following exists:
By defining dataSource and binding1 as properties within the custom control, they will be available as compositeData.
Thus, to bind a field using these components, we simply put the following definition in our custom control:
<xp:inputText value="#{compositeData.dataSource[compositeData.binding1]}">
</xp:inputText>
I hope this helps!
I am trying to add a dateTime edit box in an xPage and I would like to show the date and time
with a specific pattern that I define. The pattern is "MMM d, yyyy HH:mm". The date and time
appear in the desirable format when I open the xPage. The problem is caused when I select the checkbox "Use date/time picker pop-up". After this change, the time is not displayed correctly. It is always 00:00. Is this a bug? Or do I need to configure differently the edit box in order to use the pattern I want and be able to add a data/time picker properly?
Any help will be highly appreciated.
Thanks a lot for your time!
Yes, it's bug. I have reported it to IBM support.
You could use ExtLib Dojo Date and Time controls. There the problem is that there is a separate control for Date and Time and there is no built in way to save them in same item on document. You can do it with some SSJS though.
I have used a reqular Date/Time Edit Box ja ExtLib Dojo Time Text Box. The edit box is set to show date only and bound to my Date/Time field on datasource form. The Dojo Time Text Box gets its default value from the same Date/Time item on document.
In data source querySaveDocument event I have this code which adds the time to the date selected in date edit box:
// When time field is empty we get Java Date.
var dtDate:java.util.Date = getComponent("inpDT").getValue();
var dtTime = getComponent("djTime").getValue();
if (typeof dtTime == "lotus.domino.local.DateTime") dtTime = dtTime.toJavaDate()
// Combine date and time.
if (dtDate != null && dtTime != null) {
var dtDateTime:NotesDateTime = session.createDateTime(dtDate);
dtDateTime.setLocalTime(dtTime.getHour(), dtTime.getMinute(), 0, 0);
dominoDocument.replaceItemValue("DT", dtDateTime);
}
How can I allow selection of a date using the calandar button but disable typing of date in Dojo Date Textbox?
Is there a way to do this? If so how?
Basically I want the users to be able to select a date using the calendar button but don't allow them to manually enter a date.
Create a client-side onfocus event:
thisEvent.target.blur();
That doesn't prevent the field's value from being programmatically populated via the date helper, but if they try to manually focus (i.e. click or tab into) the field, it will kick them back out again.
There is a new property of showReadonlyAsDisabled which I tried on date time field. But it ended up creating a disabled field, but surprisingly it creates a readonly field in case of edit box. So I had to create a workaround by setting the readonly property via javascript while loading the page. Below is the code snippet:
<xp:inputText id="dateTimeField">
<xp:dateTimeHelper id="dateTimeHelper1"></xp:dateTimeHelper>
<xp:this.converter>
<xp:convertDateTime type="date"></xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
<xp:br></xp:br>
<xp:scriptBlock>
<xp:this.value><![CDATA[XSP.addOnLoad(
function() {
document.getElementById("#{id:dateTimeField}").readOnly = true;
}
);]]></xp:this.value>
</xp:scriptBlock>
I don't know if this is optimal solution, but it works!