XPages-仅在日期字段中保存日期

XPages-仅在日期字段中保存日期,xpages,lotus-notes,lotus-domino,xpages-ssjs,Xpages,Lotus Notes,Lotus Domino,Xpages Ssjs,我正在使用编辑框控件显示日期字段。保存XPage时,我只想保存日期(现在保存日期和时间)。有没有办法做到这一点 这是我的密码: <xp:inputText id="dateReparatur" value="#{document1.dateReparatur}"> <xp:this.converter> <xp:convertDateTime type="date" dateStyle="long"> </xp:convertDateTime> &

我正在使用编辑框控件显示日期字段。保存XPage时,我只想保存日期(现在保存日期和时间)。有没有办法做到这一点

这是我的密码:

<xp:inputText id="dateReparatur" value="#{document1.dateReparatur}">
<xp:this.converter>
<xp:convertDateTime type="date" dateStyle="long">
</xp:convertDateTime>
</xp:this.converter>
<xp:dateTimeHelper></xp:dateTimeHelper>
</xp:inputText></xp:td>
这只提供了日期,但是在Notes中,字段类型现在是文本而不是日期/时间,这正是我所希望的。

getDateOnly()
返回一个字符串。试试这个:

dt.setAnyTime();
currentDocument.replaceItemValue("dateReparatur", dt);
或者您可能需要获取
文档

currentDocument.getDocument(true).replaceItemValue("dateReparatur", dt);

这个代码对我有用:

    <xp:this.postSaveDocument><![CDATA[#{javascript:
        var dt:DateTime = document1.getItemValueDateTime("dateReparatur");
        dt.setAnyTime();
        currentDocument.getDocument(true).replaceItemValue("dateReparatur", dt); 
        currentDocument.getDocument(true).save()
    }]]></xp:this.postSaveDocument>
您必须在表单中的日期字段中添加
输入翻译
公式:

@Date(@ThisValue)

computeWithForm
的性能很差,有时会对字段值产生副作用,但这可能是一个很好的解决方案,尤其是当您有很多这样的仅日期字段时。

您可能需要在转换器或querySaveDocument中执行此操作:我尝试了此操作,但“DateReparator”没有成功notes中的字段为空。是否尝试使用未绑定到XPage上任何字段的项目名称?这是一个很好的方法来检查它的工作。嗨,谢谢,但我决定使用克努特的解决方案,因为它工作得很好。非常感谢这个伟大的解决方案!
<xp:this.querySaveDocument><![CDATA[#{javascript:
    document1.getDocument(true).computeWithForm(true, true)
}]]></xp:this.querySaveDocument>
@Date(@ThisValue)