码迷,mamicode.com
首页 > 数据库 > 详细

How to get date from OAMessageDateFieldBean

时间:2016-06-15 18:46:37      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:

          OAMessageDateFieldBean dateFromBean = (OAMessageDateFieldBean)webBean.findChildRecursive("pReceiptFromDate");
          String dateFromStr =  dateFromBean.getText(pageContext);
          java.sql.Date receiptFromDate = pageContext.getOANLSServices().stringToDate(dateFromStr);
          oracle.jbo.domain.Date recFromDate= new oracle.jbo.domain.Date(receiptFromDate);

 

验证的输入的日期不能大于当前月最后一天

 

OAMessageDateFieldBean dateField = 
            (OAMessageDateFieldBean)webBean.findIndexedChildRecursive("Date");
        Date valiMaxdate = new Date();
        Calendar cal = Calendar.getInstance();
        cal.setTime(valiMaxdate);
        cal.set(Calendar.DAY_OF_MONTH, 1);
        cal.roll(Calendar.DAY_OF_MONTH, -1);
        valiMaxdate = cal.getTime();
        dateField.setMaxValue(valiMaxdate);
        long maxTime = valiMaxdate.getTime();
        dateField.setOnBlur("var dff=_getDateFieldFormat(this);  var vl=dff.parse(this.value); if(vl!=(void 0)){ var currTime=vl.getTime();if(currTime>"+maxTime+"){alert(this.value+‘不能大于当月最后一天.‘);this.value=‘‘;return false}}else{var msg=‘日期格式不符合或为空,返回true,让系统去验证..‘;return true}");

 

 

 要求显示年月日时分秒,秒永远是00
 String userDateFormat = pageContext.getOANLSServices().getUserJavaDateFormat(); 
    userDateFormat = userDateFormat + " HH:mm:00 ";

    OADateValidater formatter = new OADateValidater(userDateFormat, userDateFormat ); 
dateBean.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);

 

 设置日期指定格式

        OAMessageTextInputBean money = 
            (OAMessageTextInputBean)webBean.findChildRecursive("Money");
        if (money != null) {
            money.setRequired(this.REQUIRED_YES);
            Formatter formatter = 
                new OADecimalValidater("#,###,###,##0.00;-#,###,###,##0.00", 
                                       "#,###,###,##0.00;-#,###,###,##0.00)");
            money.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);
        }

 

 

 

参考链接:

How to get date from OAMessageDateFieldBean

Setting Calendar entries in OAF page

How to get date from OAMessageDateFieldBean

标签:

原文地址:http://www.cnblogs.com/huanghongbo/p/5588537.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!