cancel
Showing results for 
Search instead for 
Did you mean: 

Highlight input field with red square line

Former Member
0 Kudos

Hi,

I noticed that in the Employee self-service application, if the user doesnt fill in a mandatory field (let say it's an input field), the application will highlight that input field with the red square line so that the user will be awared of which field data is missing (apart from displaying the error message with MessageManager).

How can i do that in WDP?

Any help would be highly appreciated. Thanks.

- julius

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

you can use the following code:

IWDMessage msg = new WDMessage(wdThis.wdGetAPI().getComponent() , "MissingInput", WDMessageType.ERROR , "Enter some Values");

IWDAttributeInfo attrInfo = wdContext.node<Name>().getNodeInfo()

.getAttribute(IPrivate<View name>View.I<Node name>Element.<Attr name>);

if(wdContext.node<node name>().current<node name>Element().get<attr name>() == null){

wdComponentAPI.getMessageManager().reportContextAttributeMessage(wdContext.node<node name>().getCurrentElement(),attrInfo, msg, new Object[] {},false);

wdComponentAPI.getMessageManager().cancelNavigation();

}

The above lines of code you can write on action of Enter for your inputField.

This will surely work.

thanks & regards,

Manoj

Message was edited by:

Manoj

Manoj Kumar

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

for "if the user doesnt fill in a mandatory field (let say it's an input field), "

Set the state property of the input field to required.

for "the application will highlight that input field with the red square line so that the user will be awared of which field data is missing (apart from displaying the error message with MessageManager"

1) create a validating method

2) Create a message

IWDMessage msg = new WDMessage(wdThis.wdGetAPI().getComponent() , "MissingInput", WDMessageType.ERROR , "<Your Message>");

3) Get the attribute info of the attribute where the redbox should appear.

IWDAttributeInfo attrInfo = wdContext.node<Name>().getNodeInfo()

.getAttribute(<Your Attribute>);

4) Raise the message if your condition violates

wdComponentAPI.getMessageManager().reportContextAttributeMessage(wdContext.node<node name>().getCurrentElement(),attrInfo, msg, new Object[] {},false);

5) Cancel the navigation

wdComponentAPI.getMessageManager().cancelNavigation();

Regards

Ayyapparaj

4)

Former Member
0 Kudos

Hi julius,

You can use this code

1. Set the propertie of the lable's state field as required.

2. Write the following code in the action

IWDMessageManager messageMgr = wdComponentAPI.getMessageManager();

Object attributeValue =

wdContext.currentDetailElement().getAttributeValue(fieldName);

IWDAttributeInfo attributeInfo =

wdContext.nodeDetail().getNodeInfo().getAttribute(fieldName);

if (attributeValue instanceof String) {

if (((String) attributeValue).length() == 0) {

messageMgr.reportContextAttributeMessage(

wdContext.currentDetailElement(),

attributeInfo,

IMessageForm.MISSING_INPUT,

new Object[] { fieldLabel },

true);

}

} else if (attributeValue instanceof Integer) {

}

3.Raise pending exception.

Regards,

karthik