cancel
Showing results for 
Search instead for 
Did you mean: 

Validation for DropdownbyIndex

Former Member
0 Kudos

Hi All,

In my view I have some InputFields and DropdownbyIndex UI elements.

I binded Value Atrributes for InputFields and Value Node for DropdownbyIndex.

While doing validation for these elements :

For <b>InputFields(Value Atrributes):</b>


IWDAttributeInfo attributeInfo=this.wdContext.getNodeInfo().getAttribute("name");

messageManager.reportContextAttributeMessage(this.wdContext.currentContextElement(),attributeInfo,IMessageSomeComp.MISSING_NAME,
new Object[] { "Name" }, false);

For <b>DropdownByIndex(Value Node):</b>



IWDAttributeInfo attributeInfo1=this.wdContext.nodeSample().getNodeInfo().getAttribute("value");

messageManager.reportContextAttributeMessage(this.wdContext.currentSampleElement()attributeInfo1,IMessageSomeComp.MISSING_NAME,
new Object[] { "Name" }, false);

If I execute this both are working fine and I am getting a Red Box around inputfield(Name). But for DropdownbyIndex it is not like that. There is no Red Box.

why it is like this and how can I solve this. Please give me some good solution.

Thanks a lot in advance.

Joe

Accepted Solutions (1)

Accepted Solutions (1)

luciano_leitedasilva
Contributor
0 Kudos

Hi,

So, you have to bind Value Attributes to DropdownbyIndex, this is the point!

Use IModifiableSimpleValueSet to populate the DropdownbyIndex.

Regards,

Luciano

Former Member
0 Kudos

Hi Luciano,

Thank you for the quick response. But I didn't get what you suggested.

Could you please elaborate that.

Thank you once again.

Joe

Former Member
0 Kudos

Hi Mandapati,

Generally we can check the mandatory condition for inputfields only not for the dropdown fileds.

I mean to say we need display the multiple values on that.

set the default value as shown

wdContext.current<VA>.set<VA>(0);

Thanks,

Lohi.

Message was edited by:

Lohitha M

luciano_leitedasilva
Contributor
0 Kudos

Sreekanth,

1 - Use any value attribute to bind with the dropdowbyindex value otherwise than value node, with this the red box will work fine.

2 - When you use value attribute to bind with the dropdowbyindex you have to use IModifiableSimpleValueSet to modify the attibute type. This attribute type will be changed to a List type. To do this, you have to read the all values at context node e put these values at this collection.

Something like that:

IModifiableSimpleValueSet valueSet = wdThis.wdGetController().wdGetContext().getContext().getModifiableTypeOf("Zhr_Set_Input.Record.Zstate").getSVServices().getModifiableSimpleValueSet();

valueSet.clear();

for (int i = 0; i < wdContext.nodeI_T005U().size(); i++){

valueSet.put(

wdContext.nodeI_T005U().getI_T005UElementAt(i).getBland(),

wdContext.nodeI_T005U().getI_T005UElementAt(i).getBezei());

}

This code is to fill a State DropDowByIndex.

Regards,

Luciano

Former Member
0 Kudos

Hi Luciano,

Thank you very much for your solution. Full points for you.

Joe

Former Member
0 Kudos

Hi Luicano,

Can you help me on how to bind context attribute dynamically to DropDownByIndex.

do i need to create context attribute at run time too, If yes, how can i do this.

i have created the same with DropdownByKey as mentioned below.

IWDDropDownByKey nameDrop = (IWDDropDownByKey) view.createElement(IWDDropDownByKey.class,"txt"+id);

String dropdownValue = aaa,bbb,ccc,ddd;

IWDNodeInfo ddlNode= wdContext.getNodeInfo().addChild("DynamicDDLNode"+id,null,true,true,true,false,false,true,null,null,null);

IWDAttributeInfo info = ddlNode.addAttribute("ddlKey" , "ddic:com.sap.dictionary.string");

ISimpleTypeModifiable myType= info.getModifiableSimpleType();

IModifiableSimpleValueSet values=myType.getSVServices().getModifiableSimpleValueSet();

String[] temp = dropdownValue.split(",");

for(int i=0; i<temp.length;i++){

          values.put(new String(temp[i]),temp[i]);

}

nameDrop.bindSelectedKey("DynamicDDLNode"+id+".ddlKey");

Please help as this is really urgent for me to resolve the issue.

Thanks,

Abhishek

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sreekanth,

You need to bind value attribute (which is under node Sample) to dropdownbyindex similar to what u did to inputfield and not value node.

Thanks.

Best Regards,

Shiva

Former Member
0 Kudos

Why didn't you select a default value and you avoid this validation¿