IBM Notes 9中的xPages日期字段,未显示默认值且Picker图标未正确对齐

时间:2013-05-06 09:46:35

标签: datepicker xpages xpinc

我已经在Notes客户端(xpinc)9中测试了Xpage应用程序,并使用日期/时间选择器找到以下错误。

给定Date字段的默认值。

  1. 在xpinc中查看时,无法在日期字段中看到默认值。单击日期选择器图标时,将显示默认值。这可能是因为dafault值超出了日期选择器图标。
  2. 日期选择器图标显示的是右侧而不是左侧。
  3. 一旦我们选择了日期,我们就无法再查看日期选择器图标了。

  4. 我的代码如下,

    <?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>
    

    在网络中预览时,默认值正常,选择器图标正确对齐。但是在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

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

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

2 个答案:

答案 0 :(得分:4)

将以下Css添加到xpage中,可以解决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,网络标准,您也可以解决此问题

答案 1 :(得分: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>

工作完美无瑕。您的代码如何?如果使用数据绑定,则从控件的属性中提取NO默认值,但控件绑定的变量提供的值。绑定总是胜过默认值。

当我查看页面源(在这种情况下在客户端生成的内容 - 您可以在安装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>

你得到了什么?