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;
java.sql.Timestamp;

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


OAMessageDateFieldBean dateField = (OAMessageDateFieldBean)webBean.findIndexedChildRecursive();
dateField.setValue(pageContext,sqlDate);


//getting oracle.jbo.domain.Date object from OAMessageDateFieldBean
//in process form request
Timestamp ts = (Timestamp)dateField.getValue(pageContext);
System.out.println(ts.getTime());
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
dateField.setMinValue(minDate);
dateField.setMaxValue(maxValue);


I hope this helps all.

13 comments:

ram said...

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

Mukul Gupta said...

Ram,
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.
--Mukul

ram said...

hi mukul,
where we have to write this code.

regards
ram

Mukul Gupta said...

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

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 Gupta said...

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

akashkumar12 said...
This comment has been removed by the author.
akashkumar12 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;
try
{
sqlDate=new Date(f.parse(dateString).getTime());
System.out.println("sqlDate::"+sqlDate);
}
catch (Exception e)
{

e.printStackTrace();
}

OAAdvancedTableBean advTableBean = (OAAdvancedTableBean)webBean.findChildRecursive("AdvTblRN");
OAColumnBean columnBean1 =
(OAColumnBean)advTableBean.findIndexedChildRecursive("column1");
OAMessageDateFieldBean dateField = (OAMessageDateFieldBean)columnBean1.findIndexedChildRecursive("startdate1");
dateField.setValue(pageContext,sqlDate);

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

Ash Manukyan said...

Hi,
did anybody corrected Firefox bug with OAInlineDatePickerBean ???
thanks

Fusion To Cloud 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.

In PR

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);
}

Unknown 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.

Unknown said...

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

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