Skip to Content
0
Former Member
Jan 09, 2008 at 02:10 PM

Check mandatory dropdownbykey

29 Views

In my view I have two dropdownbykey elements. After a push on the button I want to check if a value in the dropdown is selected.

I found the following code to check "simple" inputfields:

public void checkMandatory( java.lang.String fieldname )

{

//@@begin checkMandatory()

IWDMessageManager msgMan = wdComponentAPI.getMessageManager();

String value = wdContext.nodeProject().currentProjectElement().getAttributeAsText(fieldname);

IWDAttributeInfo projectAttr = wdContext.nodeProject().getNodeInfo().getAttribute(fieldname);

if (value.length() == 0) {

msgMan.reportContextAttributeMessage(

wdContext.nodeProject().currentProjectElement(),

projectAttr,

IMessageCCAdvice.MISSING_INPUT,

new Object[] { fieldname },

true);

}

//@@end

}

But if I run this a dump appears on

String value = wdContext.nodeProject().currentProjectElement().getAttributeAsText(fieldname);

It works fine for "simple" inputfields but not for the dropdown fields.

Can anybody help me?

Thanks in advance.

Michael