cancel
Showing results for 
Search instead for 
Did you mean: 

Validation Problem

Former Member
0 Kudos

Hi everyone,

I have created an input form with drop downs and different actions in it.

When I input a wrong date format and then select an item from a drop down the error message "Enter the value in the format 25/11/1987" occurs. I want this error message only to be displayed after I pressed the button "Save" at the end of the form. In between no validations should be made. All actions except the "Save" Action are defined "without validation". But still the error message occurs after some action was called. (e.g. Selection of a drop down element)

Can anybody help me with this problem?

Best regards,

Olaf

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

This Error is thrown by WD Framework, so it cannot be handled. Non validating event will also not work because these error are thrown before the event occurs.

Regards,

Sunitha Hari

Former Member
0 Kudos

Hi Sunitha Hari,

is there an existing SAP Note?

Regards,

Olaf

Answers (3)

Answers (3)

Former Member
0 Kudos

I solved the problem.

context

I have taken three context variables.

Firstname-->string

Name-->Enumerated simpletype

Stratdate-->date

Layout and data binding

inputfield-->startdate

dropdowmbykey-->Name

TextView-->Firstname

button

MessagePool

MessageKey-->DateIsInPast

MessageType-->error

MessageText-->you have entered ,which is in past.

Please enter valid .

Methods

checkdate with one String parameter

Implementation

public void onActionselectaction(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionselectaction(ServerEvent)

String name=wdContext.currentContextElement().getName();

wdContext.currentContextElement().setFirstname(name);

//@@end

}

public void onActionsaveaction(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionsaveaction(ServerEvent)

this.CheckDate("startdate");

wdComponentAPI.getMessageManager().raisePendingException();

wdThis.wdFirePlugOut1();

//@@end

}

public void CheckDate( java.lang.String dateparam )

{

//@@begin CheckDate()

IWDMessageManager msgmgr=wdComponentAPI.getMessageManager();

Date usrdate=(Date)wdContext.currentContextElement().getAttributeValue(dateparam);

IWDAttributeInfo attinfo=wdContext.getNodeInfo().getAttribute(dateparam);

if((System.currentTimeMillis()-usrdate.getTime())>=0)

{

msgmgr.reportContextAttributeMessage(wdContext.currentContextElement(),

attinfo,

IMessageMainComp.DATE_IS_IN_PAST,

new Object[]{ dateparam,usrdate },

true);

}

//@@end

}

and you will do the appropriate context mapping b/w second view and compController and Databinding for SecondView.

Regards

sowmya.

Former Member
0 Kudos

Hi

Check data type of value attribute bound to UI Element. Is it Date?. If data type is date then it will give u help for choosing a date by date picker

Mandeep Virk

Former Member
0 Kudos

Hi Mandeep Virk,

thanks for your tip. I already use the date picker. But for testing purposes it is important for me to know what happens if a user puts in the date in a wrong format.

Regards,

Olaf

PradeepBondla
Active Contributor
0 Kudos

Hi,

Where you are giving the date? is it input field bound to date type attribute? which UI you are using to input a DATE?

I am working with the same, (input field bind to date type value attribute) which will show a input filed and a date picker beside it. I am not getting any error messages if i type wrong date format.

PradeeP