cancel
Showing results for 
Search instead for 
Did you mean: 

Error Message

Former Member
0 Kudos

Hi all,

I have a typical requirement...

I have an input field Material Number.

When i enter an invalid Material Number (e.g: 12345)

I should get an error message which displays:

"Material 12345 does not exist" .

How do i tag the input field data to the error message??

Please help.....

Accepted Solutions (1)

Accepted Solutions (1)

nikhil_bose
Active Contributor
0 Kudos

Using Message Pool:

1) Open Message Pool, Add Message

2) Create a Key (say: INVLD_MTRL ), make it to Warning

3) Add Message as : Material does not exists.

4) save.

5) Open view where you are getting material number, and in onAction of validation, you can use the condition

sample:


String mat_num = wdContext.currrentContextElement().getMaterialNumber();
if(wdContext.currrentContextElement().getMaterialNumber() == 12345) {
  wdComponentAPI.getMessageManager().reportMessage(
    IMessageTestapp.INVLD__MTRL, new Object[mat_num] {}, true);
}

nikhil

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Create a value attribute of type Integer ( MaterialNo ) Bind it with input field, on action of input field put this code and deploy.

Could you elaborate the criteria for invalid material no, that has to be coed in if block.


if( wdContext.currentContextElement().getMaterialNo() == 12345)
{
    	wdComponentAPI.getMessageManager().reportException( " Material No " + 
			wdContext.currentContextElement().getMaterialNo() + " does not exists", true);
}

Regards

Vinod V

Former Member
0 Kudos

Hi,

you want bind/tag error msg with the input field. for that you need to use message pool.

In the message pool you need to define the error key with the error message.

As you know to display the error we used to code like:-

wdComponentApi.getMessageManager.ReportException(<msg>,true);

this will also display message but if you click/select the error Message it will not bind/tag with the respective input field for this you have to code like that:-

Read the attribute info for the Input UI context attribute:-IWDAttributeInfo info = wdContext.nodeEventInformation().getNodeInfo().getAttribute(<attibutename>);

IWDMessageManager messageManager = wdComponentAPI.getMessageManager();

messageManager.reportContextAttributeMessage(

<current context where attribute palced>,info, IMessageEventsComponent.EVENTTITLE(message pool key),new Object[] { },true);

This code will tag the error with input UI.

Hope this may help you.

Deepak

Former Member
0 Kudos

Hi,

If you trying to display the error message just below the inputField with the inputField getting highlighted then check the link below:

Hope it helps.

thanks & regards,

Manoj