on 02-09-2011 10:23 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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-
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.