cancel
Showing results for 
Search instead for 
Did you mean: 

How to Set focous to a particular field?

Former Member
0 Kudos

Hi,

I designed a page by using WebDynpro.In this page i want to set focous to a particular field.Can any one help me out from this?

with regards

Anirudh

Accepted Solutions (1)

Accepted Solutions (1)

sridhar_k2
Active Contributor
0 Kudos

Hi,

IWDInputField input = (IWDInputField)view.getElement("inputField");

input.requestFocus();

If you use above method, it just set focus on the input field. You have to use that code in wdDoModifyView().

If you want high light it (Like required Filed) use below code.

Name - Your Context Variable

NameRequired - Error Message

IWDNodeInfo nodeInfo = wdContext.getNodeInfo();

IContextElement contextElement = wdContext.currentContextElement();

String nameVal = contextElement.getName();

IWDMessageManager manager = wdComponentAPI.getMessageManager();

if (nodeInfo != null) {

IWDAttributeInfo attributeInfo = nodeInfo.getAttribute("name");

if (attributeInfo != null) {

ISimpleType simpleType = attributeInfo.getSimpleType();

if (simpleType != null) {

String fieldLabel = simpleType.getFieldLabel();

}

}

if (nameVal == null) {

manager.reportContextAttributeMessage(

contextElement,

attributeInfo,

IMessageTestComp.NameRequired,

new Object[] { "" },

true);

}

}

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Inside DoModifyView write the following code. For example the InputField id is 'EmpId'.

IWDInputField clientname=(IWDInputField)view.getElement("Empid"); clientname.requestFocus();

Like this you can put focus on any UI Element using ID.

Kind Regards,

S.Saravanan.

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Anirudh,

See this thread:

Regards

Suresh

Former Member
0 Kudos

In wdDoModifyView try to call requestFocus() on necessary UI element.

VS