Friday, November 2, 2007

Setting the default selected date for an OAMessageDateFieldBean

I have seen couple of threads in recent past on OA Forums about setting default value in OAMessageDateFieldBean, so, did a little R n D :) on OAMessageDateFieldBean.

OAMessageDateFieldBean in framework, u will find its nothing but a onClick js event is called on the imageicon attached with messagetextinput bean(in case the type is Date) and OAInlineDatePickerBean is opened in a modal js window.

Setting deafult date in the OAMessageDateFieldBean, also sets the OAInlineDatePickerBean , as it takes the default value from OAMessageDateFieldBean.
So, here is code for setting/getting value both in both in OAMessageDateFieldBean and OAInlineDatePickerBean :
import java.sql.Date;
import java.text.SimpleDateFormat;

//defining format of date
SimpleDateFormat f = new SimpleDateFormat("mm/dd/yyyy");
//define date as string
String dateString = "06/30/1984";
//defining new
Date sqlDate=new Date(f.parse(dateString).getTime());

OAMessageDateFieldBean dateField = (OAMessageDateFieldBean)webBean.findIndexedChildRecursive();

//getting oracle.jbo.domain.Date object from OAMessageDateFieldBean
//in process form request
Timestamp ts = (Timestamp)dateField.getValue(pageContext);
java.sql.Date select = new java.sql.Date(ts.getTime());
oracle.jbo.domain.Date sd=new oracle.jbo.domain.Date(select);

//You can also set min Value and Max value in OAMessageDateFieldBean which
//will also be set in OAInlineDatePickerBean
//Here is code

I hope this helps all.


ram said...

hi mukul,
iam new to OAF.i want convert java file to class file how to covert using jad.

Mukul said...

You can use command
Jad –r –s .java **/*.class

for decompiling class files to java on command prompt in windows.You can also try downloading CAVAJ, which has windows GUI and provides drag and drop functionality. It also based on jad in core.

ram said...

hi mukul,
where we have to write this code.


Mukul said...

Ram, which code? i think i have mentioned all the steps. WHat's ur exact requirement?

cnu said...

Hi Mukul,
I am using body bean onload function.It's working fine in IE and Mozilla 1.5.
Now the problem getting with Mozilla 3.
I have check the OAF pages with fire bug, it gives onload error.
Please help me to resolve

Mukul said...

Can you in detail tell what function ur using in onload, and what error ur facing in it in firefix 3

akash said...
This comment has been removed by the author.
akash said...

I have done just the same you have mentioned in process request and has used set forward url to current page in process form request and it works fine from backend.But on server from front end it does nothing.What I could have missed??

avinash said...

Setting the default selected date for an OAMessageDateFieldBean"
I want to set default value on to the OAMessageDateFieldBean, but i am using the bean inside the advanced table and has written a below code..

SimpleDateFormat f = new SimpleDateFormat("mm/dd/yyyy");
String dateString = "06/06/2011";
Date sqlDate = null;
sqlDate=new Date(f.parse(dateString).getTime());
catch (Exception e)


OAAdvancedTableBean advTableBean = (OAAdvancedTableBean)webBean.findChildRecursive("AdvTblRN");
OAColumnBean columnBean1 =
OAMessageDateFieldBean dateField = (OAMessageDateFieldBean)columnBean1.findIndexedChildRecursive("startdate1");

and i am unable to get the default value on the bean..please guide me in this.

Ash Manukyan said...

did anybody corrected Firefox bug with OAInlineDatePickerBean ???

dilip gaikwad said...

Hi Mukul,

I have one field quantity his database datatype is varchar2, I want to display this quantity field as number format like 55,555.55 on oaf page in advancedtable column field.

ActualQuantityItem is mapped with quantity column in database
I tried using fallowing code but not succeed to Format this field please help me on that.


Formatter formatter = new OADecimalValidater("#,##0.00", "#,##0.00");
OAMessageTextInputBean ActualQuantityBean = (OAMessageTextInputBean)webBean.findChildRecursive("ActualQuantityItem");
if (ActualQuantityBean != null) {
ActualQuantityBean.setAttributeValue(UIConstants.ON_SUBMIT_VALIDATER_ATTR, formatter);

Myvizhiselvi Subramani said...

Hi Mukul,

I have to set Sysdate as Default date in MessageTextInput field which data type is Date.

But am not able to set it b'se type conversion.

Could you help me in this.

Anna said...

Great and Useful Article.

Online Java Training | Online Java Training

Naviya Nair said...

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai

Online Java Training Java 8 Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai Java Training Institutes

Java Training Institutes in Chennai Java Training in Chennai

حسام داود said...

شركة تسليك مجاري المطبخ بالرياض
شركة تسليك مجاري بالرياض

شركة تسليك مجارى الحمام بالرياض
level تسليك المجاري بالرياض
افضل شركة تنظيف بالرياض
تنظيف شقق بالرياض
شركة تنظيف منازل بالرياض
شركة غسيل خزنات بالرياض
افضل شركة مكافحة حشرات بالرياض
رش مبيدات بالرياض
شركة تخزين عفش بالرياض
شركة تنظيف مجالس بالرياض
تنظيف فلل بالرياض
ابى شركة تنظيف بالرياض