Skip to Content
author's profile photo Former Member
Former Member

how to throw error when dropdown by index is blank

Hi,

In the dropdowm by index, I want to throw error if the selected value is blank, how can I do that?. I tried to get value something like here.

String = wdContext.currentT_Material.getMatnr();

if I select blank, I am getting null pointer exception.

T_material is from R/3. How can I throw error if I select blank?.

Thanks,

Sunita.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2006 at 07:54 PM
    if (wdContext.currentT_Material() == null)
    {
      /* nothing selected */
    }

    Armin

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      One more thing, whats the standard way (efficient way) to process the mandatory field. Since I have more than 10 fields, If mandatory field is blank, I want to throw error.

      public void checkMandatory(String name,String filedContextID)

      {

      String attributeValue = wdContext.currentContextElement.getAttributeAsText(filedContextID);

      String attributeinfo = wdCotext.getNodeInfo().getAttribute(filedContextID);

      if(attributeValue ==" ")

      {

      msgMgr.reportContextAttributeMessage(this.wdContext.currentContextElement(), attributeInfo,

      IMessageSimpleErrors..MISSING_INPUT, new Object[] {"Name"},true);

      }

      }

      Declare u context attribute name in current View method

      Where you used this method.

      This.checkMandatory("Ur errorMsg",Attributeof declaredView);

      Or Do u need to * red color ur input filed label do follow.

      set the property state as required for the input Field

      In the Label's property labelFor set the coressponding text field's Id.

      Thanks,

      Lohi

  • author's profile photo Former Member
    Former Member
    Posted on Oct 25, 2006 at 05:13 AM

    Sunita,

    I think the one which Roberto suggested will work fine. If u wanna throw an error message, u can either catch the exception and 'throw' it or u can use 'message manager'.

    if (wdContext.nodeT_Material().getLeadSelection() == -1)

    {

    IWDMessageManager msgmgr = wdComponentAPI.getMessageManager();

    msgmgr.reportException("No lead selection in dropdown", true);

    }

    Regards,

    Aparna .P

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.