cancel
Showing results for 
Search instead for 
Did you mean: 

For two InputFields should be only one error message displayed

Former Member
0 Kudos

Hi,

I have two InputFields of data type time. After the user has entered the times and has pressed the next button, I have to check that the difference is not larger than 5 hours.

If it is larger than 5 hours I want to give <b>one error message</b> in the MessageArea <b>but highlight the two InputFields</b> with red frames.

I used this lines of code, which present two error messages with the same text, which is not nice:

  public void onActionStep2Next(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionStep2Next(ServerEvent)
	long timeFrom = wdContext.currentContextElement().getTimeFrom().getTime();
	long timeTo = wdContext.currentContextElement().getTimeTo().getTime();
	
	long delta = timeTo-timeFrom;
	
	if (delta > (3600000 * 5)){
		IWDMessageManager msg = wdComponentAPI.getMessageManager();
		msg.reportContextAttributeMessage(
                           wdContext.currentContextElement(),
                           wdContext.getNodeInfo().getAttribute("TimeFrom"),
                           MessageMain.MAX__REQUESTED__HOURS__ERROR,
                           null,
                           false);

		msg.reportContextAttributeMessage(
                           wdContext.currentContextElement(),
                           wdContext.getNodeInfo().getAttribute("TimeTo"),
                           MessageMain.MAX__REQUESTED__HOURS__ERROR,
                           null,
                           false);

				
	} else { ... }

Do you have a way to solve this? Thank you.

Regards,

Marcus

Message was edited by: Marcus Freiheit

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You cannot have only one message displayed for two context attributes.

Even if you pass an empty message to the second call, the framework will show something like "message.<Key>" (I think).

Regards,

Satyajit.

Former Member
0 Kudos

Yes, I tried it with an empty message. In MessageArea the error symbol appeared with no text behind it.

Thank you, Satyajit

sridhar_k2
Active Contributor
0 Kudos

Hi Marcus,

Try this one. It will give you empty error symbol, but no text for it.

msg.raiseInvalidContextAttributeException(wdContext.currentContextElement(),

wdContext.getNodeInfo().getAttribute("validTo"),"",true);

Regards,

Sridhar

Former Member
0 Kudos

Hi Sridhar,

sorry, no success. In the MessageArea the error symbol is still shown with empty text behind.

Thanks for the idea,

Regards,

Marcus

Answers (0)