I created two Views. One view, it was called NavigationView, contains all buttons.The other view, it was called PlanView, contains InputFields. I want to display the error message and highlighted the input field when the "Save" button is pressed and some of the input field is empty.
There is following code in method onActionSave() of NavigationView:
IWDNodeElement element = wdContext.currentContextElement().getElement();
String displayname = element.getAttributeAsText("name");
if (displayname == null || displayname.equals("")) {
IWDAttributeInfo attributeInfo = element.node().getNodeInfo().getAttribute("name");
this.messageManager.reportContextAttributeMessage(
element,
attributeInfo,
IMessageMaintenace.T_ENTER_NAME,
null,
false);
}
The attributes of element keep values of all input fields in the PlanView.
After executing this source code, the error message is displayed on the user interface in the Web browser but the input field that is linked with the invalid context attribute is no highlighted.
Is there any way to highlighted the input field?
Regards,
Krasimira
This line looks strange to me,
IWDNodeElement element = wdContext.currentContextElement().getElement();
I can't access this method in sr1 dev studio. Are you sure you are getting the right element? Try wdContext.currentContextElement() if the attribute name is in the context node and just wdContext.currentBlahElement() if the attribute is in the blah node.
Highlighting the input fields works like a dream for us, but we use the raiseInvalidContextAttributeException method, accessing the message pool messages through wdComponentAPI.getTextAccessor().getText().
We also find webdynpro might be picky about capitalization, so if your attribute is named Name, it gives an exception
Hi Krasimira ,
To highlight a inputfield or any UIElement in a view you can do the following.
1. In the wdModifyView method first you need to create an intance of the UIElement.
Ex: input1=(InputField)view.getElement("inputfieldID");
(declare Input1 as a static global variable)
2.You can use the variable input1 in any action or method and type the following in that action/method.
input1.requestFocus();
The above call will place the control onto the respective
UIElement.
Regards,
Anilkumar
Add a comment