cancel
Showing results for 
Search instead for 
Did you mean: 

Setting focus to a DropdownByIndex UI element

Former Member
0 Kudos

Hi all,

I am using a DropdownByIndex UI Element whose texts attribute is bound to an attribute called <i>STEXT</i> which is inside a value node called <i>STATE</i>. Since this field is mandatory , I have to show some error message and set focus to this field . Using the following code , I am able to show the message but am unable to set focus to this field . Any help will be appreciated and points will be awarded

IWDAttributeInfo attributeInfoState = null;
attributeInfoState = this.wdContext.nodeState().getNodeInfo().getAttribute("stext");
if ((strState==null) || (strState.length()==0))
{ 
 msgMgr.reportContextAttributeMessage(wdContext.nodeState().getStateElementAt(0),attributeInfoState,IMessagePersDet_Comp.CHECK__MANDATORY__MSG,new Object[]{"State"},true);
}

Accepted Solutions (0)

Answers (1)

Answers (1)

Abhinav_Sharma
Contributor
0 Kudos

Hi,

You want ot set the focus to ur dropdownbyindex element right? For this create a global static boolean flag;

and the onAction of your button

if (wdContext.node<bindtodropdownbyindex>().getLeadSelection() == -1) {

flag = true;

} else {

flag = false;

}

and then write following code in wdDoModify....

if (flag) {

IWDDropDownByIndex dri =

(IWDDropDownByIndex) view.getElement("DropDownByIndex1");

dri.requestFocus();

flag = false;

}

Do reward point if it helps.

Abhinav Sharma