Reputation: 185
I'm trying to format a Dojo date text box on an XPage when the page is opened for reading.
When I edit the XPage the correct format is dd/MM/yyyy is displayed.
I already tried the pattern , the constraint, lang properties of component, and also tried the application locale but nothing solved the problem.
Does anyone know how to format the date to dd/MM/yyyy format?
Example:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:this.data>
<xp:dominoDocument var="document1" formName="Test"
action="editDocument">
</xp:dominoDocument>
</xp:this.data>
<xe:djDateTextBox id="djDateTextBox1" value="#{document1.Date}">
<xe:this.constraints>
<xe:djDateTimeConstraints datePattern="dd/MM/yyyy" />
</xe:this.constraints>
</xe:djDateTextBox>
<xp:br />
<xp:button value="save" id="button1"
rendered="#{javascript:document1.isEditable()}">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" immediate="false" save="true">
<xp:this.action>
<xp:changeDocumentMode mode="readOnly" var="document1" />
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:button value="edit" id="button2"
rendered="#{javascript:!document1.isEditable()}">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xp:changeDocumentMode mode="edit" var="document1" />
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
Upvotes: 1
Views: 402
Reputation: 185
In fact I found that showReadonlyAsDisabled property component in read mode maintain the formatting of the date.
<xe:djDateTextBox id="djDateTextBox1" value="#{document1.Date}"
showReadonlyAsDisabled="true">
<xe:this.constraints>
<xe:djDateTimeConstraints datePattern="dd/MM/yyyy" />
</xe:this.constraints>
</xe:djDateTextBox>
Upvotes: 2