1

我已经在 Notes Client (xpinc) 9 中测试了 Xpage 应用程序,并在日期/时间选择器中发现了以下错误。

给定日期字段的默认值。

  1. 在 xpinc 中查看时,无法在日期字段中看到默认值。单击日期选择器图标时,将显示默认值。这可能是因为默认值覆盖在日期选择器图标后面。
  2. 日期选择器图标显示在右侧而不是左侧。
  3. 选择日期后,我们将无法再查看日期选择器图标。

我的代码如下,

<?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:inputText id="inputText1">
        <xp:this.defaultValue><![CDATA[#{javascript:@Date("16/12/2013")}]]></xp:this.defaultValue><xp:dateTimeHelper id="dateTimeHelper1"></xp:dateTimeHelper>
        <xp:this.converter>
            <xp:convertDateTime type="date"></xp:convertDateTime>
        </xp:this.converter>
    </xp:inputText>
    </xp:view>

在 web 中预览时,默认值很好,并且选择器图标正确对齐。但是在 IBM Notes 9 (xpinc) 中预览时,默认值未显示在字段中。日期字段的 UI 看起来很糟糕!请参考以下链接

http://www-10.lotus.com/ldd/ndseforum.nsf/xpTopicThread.xsp?documentId=CA3D7B61284FEE3185257B6300352563

Notes 9 客户端似乎有问题。


我在 Notes 9 客户端中再次尝试了同样的事情。我的源代码如下

<?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.beforeRenderResponse><![CDATA[#{javascript:viewScope.DateEntered = viewScope.DateEntered || @Yesterday()}]]></xp:this.beforeRenderResponse>
    <xp:table>
        <xp:tr>
            <xp:td>
                <xp:label value="Sample date input" id="label1"></xp:label></xp:td>
            <xp:td></xp:td>
        </xp:tr>
        <xp:tr>
            <xp:td></xp:td>
            <xp:td></xp:td>
        </xp:tr>
        <xp:tr>
            <xp:td>
                <xp:label value="Please enter a date:" id="label2"></xp:label></xp:td>
            <xp:td>
                <xp:inputText id="inputText1"
            value="#{viewScope.DateEntered}">
            <xp:this.converter>
                <xp:convertDateTime type="date"></xp:convertDateTime>
            </xp:this.converter>
            <xp:dateTimeHelper></xp:dateTimeHelper>
        </xp:inputText>
            </xp:td>
        </xp:tr>
        <xp:tr>
            <xp:td>
                <xp:label value="Please enter some Text:" id="label3"></xp:label></xp:td>
            <xp:td>
                 <xp:inputText id="inputText2"
            value="#{viewScope.textEntered}">
        </xp:inputText></xp:td>
        </xp:tr>
    </xp:table>
</xp:view>

Html code in notes client like below

     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="en">
    <head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/.mini/css/@Da&amp;@Ib&amp;2Tcxsp.css&amp;2TcxspLTR.css&amp;2TcxspRCP.css.css">
    <script type="text/javascript" src="/xsp/.ibmxspres/dojoroot-1.8.0/dojo/dojo.js" djConfig="locale: 'en-us', parseOnLoad: true"></script>
    <script type="text/javascript" src="/xsp/.ibmxspres/.mini/dojo/.en-us/@Ie&amp;@Iu.js"></script>
    <script type="text/javascript">dojo.require('ibm.xsp.widget.layout.xspClientDojo')</script>
    <script type="text/javascript">dojo.require('ibm.xsp.widget.layout.xspClientRCP')</script>
    <script type="text/javascript">dojo.require('dojo.parser')</script>
    <script type="text/javascript">dojo.require('ibm.xsp.widget.layout.DateTextBox')</script>

    </head>
    <body class="xspView tundra">
    <form id="view:_id1" method="post" action="/xsp/Dev9!!ESI/Sprint55/AcctMgr.nsf/xpCombo.xsp?1367948337%3FOpenXPage&amp;xspRunningContext=Notes" class="xspForm" enctype="multipart/form-data">
    <table><tr><td><span id="view:_id1:label1" class="xspTextLabel">Sample date input</span></td>
    <td></td>
    </tr>
    <tr><td></td>
    <td></td>
    </tr>
    <tr><td><span id="view:_id1:label2" class="xspTextLabel">Please enter a date:</span></td>
    <td><input type="text" value="2013-05-06" id="view:_id1:inputText1" name="view:_id1:inputText1" class="xspInputFieldDateTimePicker" dojoType="ibm.xsp.widget.layout.DateTextBox" iconStyleClass="xspInputFieldDatePickerIcon" constraints="{datePattern:&quot;MMM d, yyyy&quot;,timePattern:&quot;h:mm:ss a&quot;,selector:&quot;date&quot;}"></td>
    </tr>
    <tr><td><span id="view:_id1:label3" class="xspTextLabel">Please enter some Text:</span></td>
    <td><input type="text" id="view:_id1:inputText2" name="view:_id1:inputText2" class="xspInputFieldEditBox"></td>

    </tr>
    </table>

    <input type="hidden" name="$$viewid" id="view:_id1__VUID" value="!dgw1o52zpc!">
    <input type="hidden" name="$$xspsubmitid">
    <input type="hidden" name="$$xspexecid">
    <input type="hidden" name="$$xspsubmitvalue">
    <input type="hidden" name="$$xspsubmitscroll">
    <input type="hidden" name="view:_id1" value="view:_id1"></form>
    <script type="text/javascript">

    XSP.addOnLoad(function() {
    XSP.attachValidator("view:_id1:inputText1",null,new XSP.DateConverter("MMM d, yyyy","This field is not a valid date."));
    }); 

    </script>
    <input type="hidden" id="XspBridgeIn">
    <input type="hidden" id="XspBridgeOut">
    </body>

但我仍然面临同样的问题。日期字段未正确对齐

https://www.dropbox.com/s/9bmj3nmcbwy1cxd/DatePicker.jpg

我正在使用notes 9 客户端和Xp 机器。

我的笔记客户端有问题吗?

4

2 回答 2

4

在 xpage 中添加以下 Css,可以解决 Notes 9 xpinc 中日期选择器的对齐问题。

<style type="text/css">
     .xspInputFieldEditBox > div {
  width:auto;
}
</style>

您的源代码将如下

<?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">
    <style type="text/css">
     .xspInputFieldEditBox > div {
  width:auto;
}
</style>

    <xp:inputText id="inputText1" value="#{viewScope.inputText1}"
        defaultValue="#{javascript:@Now()}">
        <xp:this.converter>
            <xp:convertDateTime type="date" />
        </xp:this.converter>
        <xp:dateTimeHelper />
    </xp:inputText>
    </xp:view>

即使更改主题,例如 One UI V2、2.1、Web 标准,您也可以解决此问题

于 2013-05-11T11:10:24.323 回答
0

我试过这个:

<?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.beforeRenderResponse><![CDATA[#{javascript:viewScope.DateEntered = viewScope.DateEntered || @Yesterday();}]]>
    </xp:this.beforeRenderResponse>
<xe:formTable id="formTable1" formTitle="Sample date input"
    formDescription="Test for date functionality">
    <xe:formRow id="formRow1" for="inputText1" label="Please enter a date:"
        labelPosition="left">
        <xp:inputText id="inputText1"
            value="#{viewScope.DateEntered}">
            <xp:this.converter>
                <xp:convertDateTime type="date"></xp:convertDateTime>
            </xp:this.converter>
            <xp:dateTimeHelper></xp:dateTimeHelper>
        </xp:inputText>
    </xe:formRow>
    <xe:formRow id="formRow2" for="inputText2" label="Please enter some Text:"
        labelPosition="left">
        <xp:inputText id="inputText2"
            value="#{viewScope.textEntered}">
        </xp:inputText>
    </xe:formRow>
</xe:formTable>
</xp:view>

完美无瑕。你的代码看起来如何?如果您使用数据绑定,则不会从控件的属性中提取默认值,而是从控件绑定到的变量提供的值。绑定总是胜过默认值。

当我查看页面源代码时(在这种情况下在客户端生成的内容 - 您可以在安装 Domino 设计器的机器上看到它,然后我得到:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/.mini/css/2Ojcore.css&amp;2Ojdojo.css&amp;2OldefaultTheme.css&amp;2OldojoTheme.css&amp;@Da&amp;@Ib&amp;@Th&amp;@Ti.css">
<script type="text/javascript" src="/xsp/.ibmxspres/dojoroot-1.8.0/dojo/dojo.js" djConfig="locale: 'en-us', parseOnLoad: true"></script>
<script type="text/javascript">dojo.registerModulePath('extlib', '/xsp/.ibmxspres/.extlib');</script>
 <script type="text/javascript" src="/xsp/.ibmxspres/.mini/dojo/.en-us/@Eya&amp;@Ie&amp;@Iu.js"></script>
<script type="text/javascript">dojo.require('ibm.xsp.widget.layout.xspClientDojo')</script>
<script type="text/javascript">dojo.require('ibm.xsp.widget.layout.xspClientRCP')</script>
<script type="text/javascript">dojo.require('dojo.parser')</script>

<script type="text/javascript">dojo.require('extlib.theme.OneUIA11Y')</script>
<script type="text/javascript">dojo.require('ibm.xsp.widget.layout.DateTextBox')</script>
</head>
<body class="xsp lotusui tundra">
<form id="view:_id1" method="post" action="/xsp/My2003Xpages.nsf/Test6.xsp?1367936627%3FOpenXPage&amp;xspRunningContext=Notes" class="lotusForm" enctype="multipart/form-data">
<fieldset id="view:_id1:formTable1">
<table class="lotusFormTable" role="presentation" cellpadding="0" cellspacing="0" border="0"><tbody>
<tr><td class="lotusFormTitle" colspan="3"><h2>Sample date input<div class="lotusMeta">Test for date functionality</div></h2></td></tr>
<tr class="lotusFormFieldRow"><td style="width:15%" class="lotusFormLabel"><label for="view:_id1:inputText1">Please enter a date:</label></td><td><input type="text" value="2013-05-06" id="view:_id1:inputText1" name="view:_id1:inputText1" class="xspInputFieldDateTimePicker" dojoType="ibm.xsp.widget.layout.DateTextBox" iconStyleClass="xspInputFieldDatePickerIcon" constraints="{datePattern:&quot;MMM d, yyyy&quot;,timePattern:&quot;h:mm:ss a&quot;,selector:&quot;date&quot;}">        <td></td></td></tr>
<tr class="lotusFormFieldRow"><td style="width:15%" class="lotusFormLabel"><label for="view:_id1:inputText2">Please enter some Text:</label></td><td><input type="text" id="view:_id1:inputText2" name="view:_id1:inputText2" class="xspInputFieldEditBox"><td></td></td></tr>
</tbody>
</table>

</fieldset>

<input type="hidden" name="$$viewid" id="view:_id1__VUID" value="!dgw05ue5xc!">
<input type="hidden" name="$$xspsubmitid">
<input type="hidden" name="$$xspexecid">
<input type="hidden" name="$$xspsubmitvalue">
<input type="hidden" name="$$xspsubmitscroll">
<input type="hidden" name="view:_id1" value="view:_id1"></form>
<script type="text/javascript">

XSP.addOnLoad(function() {
XSP.attachValidator("view:_id1:inputText1",null,new XSP.DateConverter("MMM d, yyyy","This field is not a valid date."));
}); 

</script>
<input type="hidden" id="XspBridgeIn">
<input type="hidden" id="XspBridgeOut">
</body>
</html>

你得到了什么?

于 2013-05-07T05:25:26.127 回答