cancel
Showing results for 
Search instead for 
Did you mean: 

reportContextAttributeMessage: Highlighting fields with one error message

Former Member
0 Kudos

Hi

I have a questions about error handling:

How can I highlight several error fields but displaying just ONE error message? I'm using the common error messaging like

messageMgr.reportContextAttributeMessage(wdContext.currentContextElement(), attributeInfo, IMessageSimpleErrors.MISSING_INPUT, null, true);

Thanks

Stefan

Accepted Solutions (0)

Answers (3)

Answers (3)

pradeep_kumar5
Active Participant
0 Kudos

Hi Stefan,

why don't you try manually i.e.

If you had 3 input fields like name (String), age(integer), location(String).

if(name!=null&&age!=0&&location!=null){

// The above condition is true if all fields are filled otherwise goes to else condition

//write any code u want

}else {

messageMgr.reportContextAttributeMessage(wdContext.currentContextElement(), attributeInfo, IMessageSimpleErrors.MISSING_INPUT, null, true);

}

Hope it helps..

Regards,

Pradeep Kumar G

david_palafox
Explorer
0 Kudos

You should try using

...reportContextAttributeMessage(IWDAttributePointer[] attributes, IWDMessage message, Object[] args);

You would need to create an array with attribute pointers for all the attributes you want highlighted. The way you create an IWDAttributePointer is as follows:

wdContext.currentContextElement().getAttributePointer(String attributeName);

And of course, you would need to either create a message in your code or in your message pool. (I'd go with message pool). If you decide to go for message pool, the way you call that message is like this:

IMessage<YourComponent>.<MessageName>

This will show ONE message, but will highlight as many fields as you entered in your array. I use this myself and it works. If you have any further questions, let me know.

-David-

Former Member
0 Kudos

Hi David,

I hope your solution would be useful to me. In my scenario, I need to display a single error message for almost 200 input fields if they are null.

And I am having the value attributes(which are binded to the input fields) in 3 different value nodes.

Can you please help me in implementing this?

I was trying to solve in the following manner. But failed.

Created a method checkMandatoryEntInitialAmt and given the fuctionality as follows.

public void checkMandatoryEntInitalAmt( java.lang.String InitialEntAmt )

{

//@@begin checkMandatoryEntInitalAmt()

// wdComponentAPI.getMessageManager().reportSuccess("3");

IWDMessageManager messageMgr =wdComponentAPI.getMessageManager();

Object attributeValue = wdContext.currentContextElement().getAttributeValue(InitialEntAmt);

IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(InitialEntAmt);

if (attributeValue == null)

{

String filedLabel = wdContext.getNodeInfo().getAttribute(InitialEntAmt).getSimpleType().getFieldLabel();

messageMgr.reportContextAttributeMessage(wdContext.currentContextElement(),attributeInfo,

IMessageApplyEntVersion2.ENT__INITIAL_AMT,new Object[] { filedLabel },true);

messageMgr.cancelNavigation();

// messageMgr.raisePendingException();

}

//@@end

}

Now I am calling this method in OnAction Submit as follows..

checkMandatoryEntInitalAmt(IPrivateApplyEntVersion2View.IAaaElement.INITIAL_ENT__AMT);

messageMgr.raisePendingException();

Cheers,

Anu.

Former Member
0 Kudos

Hi Stefan,

Put a MessageArea UIElement on your view. In the properties of the element set the MaxVisibleMessages to 1.

Hope this helps.

Best regards,

Alain.

Former Member
0 Kudos

Thanks! Unfortunately it doesn't solves the my problem as I expected (I'm already using the Message Area).

If I set the property maxVisibleMessages to "1" then the paging controls are shown, see also