xPage dateTime选择器验证不适用于日期更改 [英] xPage dateTime picker validation does not work on date change

查看:80
本文介绍了xPage dateTime选择器验证不适用于日期更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的datePicker控件,在其中可以进行表达式验证:

Here is my datePicker control where expression validation works fine:

<xp:inputText id="inputComboUntil">
    <xp:this.converter><xp:convertDateTime pattern="MMM d, yyyy"></xp:convertDateTime></xp:this.converter>
    <xp:this.validators>
        <xp:validateExpression>
            <xp:this.expression><![CDATA[#{javascript:var var1 = getComponent("inputDate").getValue();
                if(var1!=null){
                    var var1D:NotesDateTime = session.createDateTime(var1);
                    var var2D:NotesDateTime = session.createDateTime("Today");  
                    var2D.setNow();

                    if(var1D.timeDifference(var2D) < 0){ 
                        return false;
                    } else {
                        return true;
                    }
                } else {
                    return true;
                }}]]>
            </xp:this.expression>
            <xp:this.message><![CDATA[You cannot set date in the past]]></xp:this.message>
        </xp:validateExpression>
    </xp:this.validators>
    <xp:dateTimeHelper id="dateTimeHelper3"></xp:dateTimeHelper>
</xp:inputText>

但是,如果我选择了另一个正确的日期,则似乎可以使用旧的日期进行验证,因此会因验证错误而失败.我在onChange事件中一无所有.假设选择新日期应该刷新验证. 注意:我在Domino 8.5.3上有此问题

But if I pick another correct date it seems the validation works with the old one so then fails with validation error. I have nothing in onChange event. Assume picking new date should refresh validation. Note: I have this problem on Domino 8.5.3

推荐答案

请改用getSubmittedValue(),但请注意,该值将是字符串,而不是日期.

Try getSubmittedValue() instead, but note the value will be a String, not a Date.

基本的部分刷新生命周期为:

Basic partial refresh lifecycle is:

  1. RESTORE_VIEW-获取页面的服务器端地图(组件树)
  2. APPLY_REQUEST_VALUES-将在浏览器中输入的字符串值推入组件的submittedValue属性
  3. PROCESS_VALIDATIONS-检查submittedValue属性是否可以转换为正确的数据类型并通过验证
  4. UPDATE_MODEL_VALUES-转换submittedValue并写入value属性,清除submittedValue属性
  5. INVOKE_APPLICATION-运行SSJS
  6. RENDER_RESPONSE-计算要输出的HTML
  1. RESTORE_VIEW - get server-side map of the page (component tree)
  2. APPLY_REQUEST_VALUES - push string values entered into browser into components' submittedValue property
  3. PROCESS_VALIDATIONS - check submittedValue properties can be converted to correct datatype and pass validation
  4. UPDATE_MODEL_VALUES - convert submittedValue and write to value property, clearing submittedValue property
  5. INVOKE_APPLICATION - run SSJS
  6. RENDER_RESPONSE - calculate HTML to output

这篇关于xPage dateTime选择器验证不适用于日期更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆