cancel
Showing results for 
Search instead for 
Did you mean: 

Date validation in WebDynpro Java Input filed UI

Former Member
0 Kudos

Dear All,

I have input filed UI in a view with context attribute bided to this UI element of type simple Date.

now if i execute WD application, i can pickup some date from calender.

instead of picking up from date picker, if i enter some values in input field

say 123, xyz and intially i will pickup date from date picker say 10/01/2009 now i will delete either date or month or year only then press button.

this time i will get an error enter the value in the format 11/25/1987.

although this message is not hardcoded in my code and also this message is not there in the message pool.

i feel this is generic message from WebDynpro frmae work.

How can overcome this message, is there any code to validate above scenario

Thanks in Advance

Murali

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You are getting the error message when you are manually entering the date because you have chosen the context attribute type of date. To solve your problem what you can do is chose the attribute type of string and then put your own validation while getting the date from the user.

You can also check the following link for the usage of different ui elements where calendar is one:

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b06c8c9a-19a4-2b10-d985-9ae7a438...

It may help you/

Regards.

Rajat

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Try a work around to change the format of date as below

SimpleDateFormat g_objDateFormat = new SimpleDateFormat("MMMM dd, yyyy");

wdContext.currentContextElement().setAbc(g_objDateFormat.format(dt));

or else first take the input in Context Attribute of type String and later on convert it into Date.

Regards

Raghu

Former Member
0 Kudos

Hi Murali,

You can define your own messages in the message pool and show them based on the validation done on the input field. You can use the Web Dynpro Message Manager API for the same (there are reportSuccess, reportError, etc methods available on it).

Kind Regards,

Nitin

Former Member
0 Kudos

Hi Murli,

After deleting either months or data you are getting the error mrssage because if you are using context of type date then it is intrnally validated for the date format 11/25/1987.

So it will automatically give the error and one cannot change this if one has used date type context.

Work Around could be like you can disabled the input field after selecting the date from it so that user cannot modify or change the date manuaaly.

if you want more info on it. i can help you.

Regards

Narendra