cancel
Showing results for 
Search instead for 
Did you mean: 

problem in error message display

Former Member
0 Kudos

public void messid( )

{

//@@begin messid()

msg = wdComponentAPI.getComponent().getMessageManager();

IPublicMessage.IEmpNode node = wdContext.nodeEmp();

IPublicMessage.IEmpElement ele = node.currentEmpElement();

if(ele.getId().length()<3 );

{

msg.raiseMessage(IMessageMessage.MSGID,new Object[]{"id"},true);

msg.reportSuccess("must not be empty");

}

//@@end

}

In the above code to display simple error message, even if i m entering more than 3 digits, it is displaying the error msg.What si the problem????

Accepted Solutions (1)

Accepted Solutions (1)

former_member193726
Active Participant
0 Kudos

Hi Pinki,

One quick question.

Are you using a semicolon after the if condition?

<b>if(ele.getId().length()<3 );</b>

{

msg.raiseMessage(IMessageMessage.MSGID,new Object[]{"id"},true);

msg.reportSuccess("must not be empty");

}

If yes, please remove the semicolon and execute your code. Should work.

Regards,

Rekha Malavathu

former_member186016
Active Contributor
0 Kudos

Correct

Regards,

Ashwani Kr Sharma

Answers (9)

Answers (9)

Former Member
0 Kudos

Hi

Remove the semicolon from the if loop

Regards

Chandran S

Former Member
0 Kudos

first of all if i m calling the method reportsuccess after raisemessage, it is not displayig because my MSGID is of error type, and program execution is stopping after that.

in both od the cases, id input is of length greater than 3 digits, the error persists

former_member186016
Active Contributor
0 Kudos

Can you remove "msg.raiseMessage(IMessageMessage.MSGID,new Object[]{"id"},true);" and just test run your stuff to check if the behavior is as i specified.

Regards,

Ashwani kr Sharma

Former Member
0 Kudos

i tried with if(Integer.parseInt(ele.getId()) < 3 ),

the error is still there

former_member186016
Active Contributor
0 Kudos

1) If you have this code:

if(ele.getId().length()<3 )
{
msg.raiseMessage(IMessageMessage.MSGID,new Object[]{"id"},true);
msg.reportSuccess("must not be empty");
}

Then for input 0 to 99 you will get the message "must not be empty".

For values higher or equal than 100 you will not get the message.

Please check if this is happening ?

2) If you code like this:

if(Integer.parseInt(ele.getId()) < 3 )
{
msg.raiseMessage(IMessageMessage.MSGID,new Object[]{"id"},true);
msg.reportSuccess("must not be empty");
}

For input 0-2 you will get the message "must not be empty".

For values higher or equal to 3 you will not get the message.

Please check if this is happening ?

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

it is taking the no. of digits i m inputing...that is if i m inputing 6 digits it is showing 6, if input is 7 digits than it is displaying 7......so now????

former_member186016
Active Contributor
0 Kudos

It must be length of string... so if you input 12345 it will not show error.

If you enter 12 it will show the error.

You comparing length of string not the int value.

try:

if(Integer.parseInt(ele.getId()) < 3) {

msg.raiseMessage(IMessageMessage.MSGID,new Object[]{"id"},true);

msg.reportSuccess("must not be empty");

}

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

by default it is displaying '6'.....

dt is it must tk atleast 6 digits

Former Member
0 Kudos

the method reportsuccess(string) int he IWDMessageManager is not applicable for the arguments(int)

former_member186016
Active Contributor
0 Kudos

Hi,

Can you check following in the if clause

msg.reportSuccess(ele.getId().length());

Just to check what is the length of the Id field. May be you comparing wrong value here.

Regards,

Ashwani Kr Sharma

former_member186016
Active Contributor
0 Kudos

try :

msg.reportSuccess(ele.getId().length()+"");

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

hi....

my problem is dt originally if my id legth is less than 3 digits than it should display the error message 'MSGID'...however, even if i m inputing more than 3 digits in the input field , it is displaying the error message.

Former Member
0 Kudos

HI pinki,

tell me..briefly

whats ur problem?

i didn't get ur problem?

Regards,

P.Manivannan.