Xpages Date Time Picker field defaults to today's date

心已入冬 提交于 2019-12-18 07:05:13

问题


Running a ND9 server and when browsing a Xpage with a date field, the default value for this field is always today's date.

On a 8.5.3 server the control is rendered like this:

<input class="dijitReset dijitInputInner" dojoattachpoint="textbox,focusNode" autocomplete="off" type="text" aria-valuenow="undefined" aria-invalid="false" id="view:_id1:_id2:main:fromTDate" tabindex="0" value="">
<input style="display: none;" type="text" name="view:_id1:_id2:main:fromTDate">

On a ND9 server the same control renders like this:

<input class="dijitReset dijitInputInner" type="text" autocomplete="off" data-dojo-attach-point="textbox,focusNode" role="textbox" aria-haspopup="true" aria-invalid="false" tabindex="0" id="view:_id1:_id2:main:fromTDate" maxlength="10" size="10" value="">
<input type="hidden" name="view:_id1:_id2:main:fromTDate" value="2013-03-26">

I've been able to circumvent it by adding a Dojo Date Text Box instead but this feature must be wrong, right?


回答1:


This was actually a fix put into v9.0. Today's date appearing by default is now the expected behaviour




回答2:


Add this to your XPage and the behavior is like in 8.5.3

<xp:this.resources>
<xp:script clientSide="true">
<xp:this.contents><![CDATA[
require([
"dojo/_base/lang",
"ibm/xsp/widget/layout/DateTextBox",
"ibm/xsp/widget/layout/TimeTextBox",
"ibm/xsp/widget/layout/DateTimeTextBox"
], function(lang, DateTextBox, TimeTextBox, DateTimeTextBox){
var a = {};
lang.mixin(a, {
postCreate: function(){
this.inherited(arguments);
}
});
DateTextBox.extend(a);
TimeTextBox.extend(a);
DateTimeTextBox.extend(a);
});
]]></xp:this.contents>
</xp:script>
</xp:this.resources>

Thanks IBM for the fast response.



来源:https://stackoverflow.com/questions/15632042/xpages-date-time-picker-field-defaults-to-todays-date

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!