cancel
Showing results for 
Search instead for 
Did you mean: 

Input field validation(pointing to the next field)

Former Member
0 Kudos

Hi All,

Can any one tell me a solution for this,

I have 10 input fields and one save button in my view. If user enters values in

4 inputfields and press save button then system shoud point to the 5th field without considering the mandatory fields.

Thanks & Regards

Shareena

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

To set focus you can use the following code

IWDInputField inputField = (IWDInputField) view.getElement("<Your UI Element>");

inputField.requestFocus();

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj,

Thank you for your valuable information.

Thanks & Regards

shareena

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Shareena,

Use Message editor & Message format for this. its better if u make the field as required instead of checking values one by one.

Check this for the steps

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/837d9290-0201-0010-1381-e633fe17cb14">Validations</a>

it will automatically take the focus to field.

regards

Sumit

Former Member
0 Kudos

Hi,

Create an "error" Message in MessagePool with Key.. Key1

and use this code ti focus

Object attValue=wdContext.currentContextElement().getAttributeValue(IPrivate<ViewName>.IContextElement.<Field5>);

IWDAttributeInfo attInfo=wdContext.getNodeInfo().getAttribute(IPrivate<ViewName>.IContextElement.<Field5>);

if (attValue==null)

{

objMessageManager.reportContextAttributeMessage(wdContext.currentContextElement(),attInfo,IMessage<ComponentName>.KEY1,null,true);

return;

}

Similarly you can check and focus other fields.. Just Replace <Field5> with some other <Field> and IMessage<ComponentName>.<KEY>

Regards

LakshmiNarayana