How to get date from OAMessageDateFieldBean

          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 dateFromBean = (OAMessageDateFieldBean)webBean.findChildRecursive("pReceiptFromDate");
dateFromBean.setValue(new java.util.Date());

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

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

上一篇:mrp功能分类


下一篇:UINavigationBar