cancel
Showing results for 
Search instead for 
Did you mean: 

Date validating in the Webdynpro UI

fabio_bellocchio
Participant
0 Kudos

Hi,

Maybe somebody has already solved this kind of problem..

I have an input date field in the UI, and Webdynpro checks if the value entered is valid when any Action is started.

If it's a wrong date, like "abc", it shows a message like "please, give a value in format...". So far so good.

But my application is in Portuguese (Brazil), and

I need to translate this message!

Instead of this, I think I could lock the input by the keyboard, since there is a pick-applet to select the date, and thus there wouldn't be chance to errors.

Or even more, I could handle the wrong value entered to throw an appropriate message, BUT Webdynpro doesn't get this wrong value, and I can't receive it in my code (Controller View).

Anyway, I don't know how to implement any of the 3 above options.

Could anybody help me ?

Thanks,

Fabio

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

These messages come from the Java DDIC (data dictionary) layer. Search this forum for how to add additional resource bundles for DDIC messages.

Armin

fabio_bellocchio
Participant
0 Kudos

Hi Armin,

I wasn't able to find "how to add additional resource bundles for DDIC messages" in this forum. Could you please give me any reference?

Thanks,

Fábio.

Former Member
0 Kudos

See this

Armin

Answers (1)

Answers (1)

Former Member
0 Kudos

Fabio,

if it is in English, validating a date is not a big deal. Is this what you want?. You can implement the first option, which is when you are taking the date and validating....this is the code snippet taken from the No.3 tutorial....

public void checkDateInPast(java.lang.String fieldName) {

//@@begin checkDateInPast()

IWDMessageManager msgMgr =

wdComponentAPI.getMessageManager();

Date theDate = (Date)

wdContext.currentContextElement().getAttributeValue(fieldName);

IWDAttributeInfo attributeInfo =

wdContext.getNodeInfo().getAttribute(fieldName);

if (theDate.after(new Date(System.currentTimeMillis()))) {

String fieldLabel =

wdContext.getNodeInfo().getAttribute(fieldName)

.getSimpleType().getFieldLabel();

msgMgr.reportContextAttributeMessage(

wdContext.currentContextElement(),

attributeInfo,

IMessageSimpleErrors.DATE_IS_IN_FUTURE,

newObject[] { fieldLabel, theDate },

true);

Thanks,

Raj.

fabio_bellocchio
Participant
0 Kudos

Hi Raj,

not exactly...

My problems actually are:

1) I have to report the wrong entrance of a string instead of a valid date.

2) The language of the message. Unfortunately I can't leave it in English.

Concerning that the input field is already a date, and so webdynpro doesn't run my code without throwing a message in English before.

I don't know, but I'm thinking about treating it on the wdModifyView, in order to access the value of the input field before webdynpro throws the message.

Lets try.. rs

Thank you!!

Regards