on 01-29-2008 7:01 AM
Hi,
I created a drop down by index UI element. I want to display the validation message when we select and empty value. I am not able to display the validation message.
Code Sample:
//Code for creating UI element
List ddbiList = new ArrayList();
temp = wdContext.nodeDropDownByIndex().createDropDownByIndexElement();
temp.setAttributeValue("value", "INDEX 1");
ddbiList.add(temp);
temp = wdContext.nodeDropDownByIndex().createDropDownByIndexElement();
temp.setAttributeValue("value", "INDEX 2");
ddbiList.add(temp);
temp = wdContext.nodeDropDownByIndex().createDropDownByIndexElement();
temp.setAttributeValue("value", "INDEX 3");
ddbiList.add(temp);
wdContext.nodeDropDownByIndex().bind(ddbiList);
When I am using the below code to display the validation I am getting null pointer exception stating that node, attributeinfo is null. I am getting this exception only when we didn't select any value.Even if I kept this statement in catch block, it is throwing the exception.
msgMgr.reportContextAttributeMessage(nodeElement, attributeInfo, IMessageValidationRuleComp.TEST_MANDATORY, null, true);
Can anyone help me in solving this.
Hi, xD i posted the solution to this at the bottom on this thread:
[Dynamic validation regardless UI element|;
Regards
Julio César Herrera
PD: That nullpointer ur getting... i guess its because validation against null its no checked first, in my solution i get the attribute value as object, like this i can check it against null with no probs, in case its not null, get its string value toString( ) , then you can compare that string length against zero.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this:
if(wdContext.nodeDropDownByIndex().currentDropDownByIndexElement().get<ATTR_NAME>() != null){
// Do your code
} else {
msgMgr.reportContextAttributeMessage(nodeElement, attributeInfo, IMessageValidationRuleComp.TEST_MANDATORY, null, true);
}
Make sure that attributeInfo is for ATTR_NAME.
thanks & regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vallabhaneni,
Have u written the following code after u have created the attribute info object???
objAttributeInfo = wdContext.node<ValueNodeName>.getNodeInfo.getAttribute("<valueAttribute>");
try this out. Hope this helps u
Regards,
Poojith MV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.