Skip to Content
avatar image
Former Member

problem in error message display

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????

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

10 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 20, 2007 at 11:49 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 07:28 AM

    HI pinki,

    tell me..briefly

    whats ur problem?

    i didn't get ur problem?

    Regards,

    P.Manivannan.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:13 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 20, 2007 at 08:14 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:27 AM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:39 AM

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

    dt is it must tk atleast 6 digits

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:46 AM

    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????

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • avatar image
    Former Member
    Aug 20, 2007 at 09:11 AM

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

    the error is still there

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • avatar image
    Former Member
    Aug 20, 2007 at 09:29 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 11:59 AM

    Hi

    Remove the semicolon from the if loop

    Regards

    Chandran S

    Add comment
    10|10000 characters needed characters exceeded