cancel
Showing results for 
Search instead for 
Did you mean: 

UI validation - displays the error message in Parent window & not in child

Former Member
0 Kudos

Hi,

I was trying to validate few UI elements in the Child/Popup window. But the error messages are getting displayed in the parent window rather in the child window. The MessageArea UI element is there in both Parent as well as Child windows View's.

Below is the code i have written in the child window:

public boolean isMinQuantity( )

{

//@@begin isMinQuantity()

IWDMessageManager messageMgr =

wdComponentAPI.getMessageManager();

if (String.valueOf(wdContext.currentItemElement().getMinQuantity()) instanceof String

&& wdContext.currentItemElement().getMinQuantity()!=0) {

return true;

}

else {

if(wdContext.currentItemElement().getMaxQuanity()!=0) {

messageMgr.reportContextAttributeMessage(

this.wdContext.currentContextElement(),

this.wdContext.getContext().getRootNodeInfo().getAttribute("minQuanity"),

IMessageEpsonRFQComp.MIN_QUANTITY,

null,

true);

} else {

messageMgr.reportException("Please enter Minimum Quantity which is more than 0.",true);

}

return false;

}

//@@end

}

Please help.

Thanks,

Regards,

Aditya Metukul

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hi Aditya,

Just add MessageArea UI elelement to your child window. And that`s it.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

If you have multiple MessageArea elements, you need to disable all of them but the one you wish to display the message (in this case, the MessageArea on the child window). To disable the MessageAreas, bind their enabled properties to boolean, read-only context attributes and set those attribute values to false.

Hope this helps...

Former Member
0 Kudos

Dear David,

Your solution really works.

But only when i set the Context Attribute's ReadOnly Property To True.

Thanks for the help.

Regards,

Aditya Metukul

Former Member
0 Kudos

what version is your NWDS?

I am not successful in replicating this...

I have boolean context set to readonly and bound to the enabled attribute of the MessageArea UI in both windows.

I set the context attribute to false prior to showing the popup window and set it back to true after closing the popup.

I am running SP7.

Thanks

Former Member
0 Kudos

Dear Ken,

I am using SP15 for NWDS.

I guess its not the problem with the version, but with something else in the code.

Just make sure that boolean context attribute is set to false whenever you open the popup window and before that always set the boolean context attribute's readonly property to "true" and this is only for parent window'S MessageArea UI. And this worked for me.

Thanks,

Regards,

Aditya Metukul

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

The messageMgr.reportException() always point to the Parent and not the client

Try this

Create a attribute as error and bind it to the child view.

Create a UI element lable and bind the property text to the error attribute.

At run time set the error message to the attribute.

wdContext.current<Name>Element().setError("Please enter Minimum Quantity which is more than 0");

Kind Reagrds

Mukesh

Former Member
0 Kudos

Dear Mukesh,

I guess thats a work around, and not the exact solution for UI validations for Popup Windows.

I needed the actual solution using MessageArea ui elements itself.

Thanks,

Regards,

Aditya Metukul

Former Member
0 Kudos

MessageArea UI can be used only in one window. Even if it is used in two windows, it will remain active only in the parent window. - SAP Documentation states that.

You can give a UI validation without a message area in Popup Window.

Regards,

Subramanian V.