cancel
Showing results for 
Search instead for 
Did you mean: 

Highlight ("mark with red background") input field and cells in a table

Former Member
0 Kudos

Hey there,

sry for the title, had some problems to figure an appropriate one

I've the following problem:

Situation

Web Dynpro View with some InputFields and a table with one colum consisting of input fields. I'm using a custom controller (validator) for validating the entered data. If any errors occur, a the message manager is called, an according exception is created and the navigation is canceled.

2 of the InputFields are used to enter a start- and an enddate.

The table rows consist of 1. A Projects Name (Text) and 2. an InputField where a number (int) has to be entered.

Problem 1: How to mark a field as "Error source" without using the reportContextAttributeMessage-Method of the MsgMgr?

During the validation of the date fields I'm checking if the startdate is AFTER the enddate. If that's the case, I'm calling the reportContextAttributeMessage but unfortunately I can only assign ONE AttributePointer, so that only ONE InputField is highlightet. Is there any other method with which i can archieve this "highlighting effect" without an own error message displays, so that i could assign the remaining InputField? My workarounf 'till now is an empty message but that just doesn't look good..

Problem 2: How to mark multiple/certain table cells?

This is basically the same problem as I mentioned above except the fact, that the table cells are dynamically created via given Inputmapping of the webdynpro component. I've to admit I'm new to WebDynpro and this is the first time I'm dealing with tables, but I've no clue how I can get the "AttributePointer" (which is required for reportContextAttributeMessage()) of a certain table cell.

Hope someone can help me on this one

Kind regards

Pascal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ad 2: You can get a attribute pointer via IWDNodeElement.getAttributePointer(String attributeName). A cell in a table is identified by its row (node element) and the attribute used by the cell editor.

Armin

Former Member
0 Kudos

Hey Armin,

thanks for your answer.

Could you drop a line of sample code or a source where i can found some? It's much easier with an example where i can see the syntax and test it myself.

Regards

Pascal

Former Member
0 Kudos

Say your table data source node is named "Rows" and your cell editor is an InputField and the "value" property is bound to an attribute "name" under the data source. Then you get an attribute pointer for the second row with


IRowsElement secondRow = wdContext.nodeRows().getRowsElementAt(1);
IWDAttributePointer ap = secondRow.getAttributePointer(IRowsElement.NAME);

Armin

Former Member
0 Kudos

Hey Armin,

thats exactly what I was looking for, thx very much.

Problem 2 is kinda solved, but do you know if there's anything that could help me out at problem 1? Or do u have an idea for a workaround or anything? Can't imagine that this never came up..

Regards

Pascal

Former Member
0 Kudos

Did you know... u can do a lot of reportContextAttributeMessage(...) lines, and then activate them all at the same time with a:


wdComponentAPI.getMessageManager().raisePendingException();

its not limited to 1 report as you seem to think..

Cheers and sorry if this is not the case 😛 im just trying to help.

Regards

Julio Herrera

Former Member
0 Kudos

Hi,

I have a same kind of requirement. I am able to highlight the field with error. But the problem is in getting focus. I have a scrollable table. So if the error is in one the rows which is visible then the focus changes on clicking the error message. But when the error is in a row which not visible presently, the focus doesnot change on clicking the error.

e.g.:

I have 100 lines of data in a scrollable table, and only 10 lines are visible at one time. The is at line no. 80 and presently line 1-10 are visible. So, if i click the error message, the cursor is not changing, it still shows line 1-10. But if i scroll down to line 80, and then click the error msg, the focus is changing to the exact field.

Kindly help in this.

Answers (1)

Answers (1)

monalisa_biswal
Contributor
0 Kudos

hi Pascal,

You can use method reportContextAttributeMessage(IWDAttributePointer[] attributes,

IWDMessage message,

Object[] args) for highlighting multiple inputfields.

Or you can use textviews instead of label besides the inputfield. Bind its semantic color property to an attribute.

Set it to Negative or Marked2 to highlight it.

Hope this helps!

Monalisa

Former Member
0 Kudos

Hey Monalisa,

>

> You can use method reportContextAttributeMessage(IWDAttributePointer[] attributes,

> IWDMessage message,

> Object[] args) for highlighting multiple inputfields.

thx for this hint, I should have read the docu more thoroughly

This solved my problem.

To Julio: I was aware of that and that's not the problem, but thx anyway ^^