cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Cursor on the Input field in case of a n error message

Former Member
0 Kudos

Hi All,

How to set the cursor in case an error message is poped up.

What is the way and can u suggest me the piece of code.

Regards

Dipendra

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Easiest way is through accessing the UIElement and calling requestFocus() method . But i feel best way is doing through context programming !!!

Regards, Anilkumar

sridhar_k2
Active Contributor
0 Kudos

Hi,

Try with this code. It will point the cursor to the required input field.

IWDNodeInfo nodeInfo = wdContext.getNodeInfo();

IWDAttributeInfo attributeInfo=null;

String fieldLabel = null;

ISimpleType simpleType=null;

IcontextElement contextElement = wdContext.currentContextElement();

IWDMessagemanager manager = wdComponentAPI.getMessageManager();

if(nodeInfo != null){

attributeInfo = nodeInfo.getAttribute("ur context variable - which is mapped to input field");

if(attributeInfo!=null){

simpleType=attributeInfo.getSimpleType();

if(simpleType!=null){

fieldLabel =simpleType.getFieldLabel();

}

}

if (Str(your variable - which you want to check value)==null){

manager.reportContextAttributeMessage(

contextElement,attributeInfo, IMessage XXXX Component.Message,new Object[]{""},true);

}

}

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi

The less preferable way is to direct call to request the focus:


((IWDInputField) view.getElement("inputFieldName")).requestFocus();

BR

sergei

sridhar_k2
Active Contributor
0 Kudos

Hi Siarhei,

Cursor is going to that Field. But InputFiled is not getting hightlighted in red. How to get that one with ur code?

Thanks,

Sridhar

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Sridhar

Highlighting should be implemented by code posted by you. My code was just for requesting focus. I guess the to examples can be joined if this is required.

BR

Sergei

Former Member
0 Kudos

HI,

i think for each input filed you might have been having one label, for labelfor id property of Label UI element you mention the input filed id. You will get highlighted red however to show error message you have to code.

hope this helped you

Regards,

RK