cancel
Showing results for 
Search instead for 
Did you mean: 

Request focus to UI element in another view

Former Member
0 Kudos

Hello all,

I have a WebDynpro application that contains a number of views. Mostly these views group logicalaly relevant input fields together. Another view contains the submit button. From this submit button view I check mandatory fields in the other views (using the context of a custom controller).

My question is this; How can I, from the submit button view, request focus to a UI element of one of the other views, to a mandatory field that has not been filled?

My fix was to create a plug, out of the submit button view into a view with mandatory fields. This plug is fired from the submit button view only if the mandatory field has not been filled in. This brings me into the view with the incomplete mandatory field and from there I request the focus.

I feel though that there is probably a better way of doing this, that perhaps I can request focus to the UI element from the submit button view itself. Is this possible?

Thanks for your time,

Patrick.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Did you try to call a suitable method of the IWDMessageManager API e.g. IWDMessageManager.reportInvalidContextAttributeException()?

This should display your message and focus the corresponding UI element automatically.

Armin

Former Member
0 Kudos

Hi Armin,

I tried the solution that you supplied.

The error message is indeed displayed, underneath the appropriate view, but the UI element does not receive focus.

The UI element has its border turned red but the cursor does not appear inside meaning that the page doesn't scroll up to display that UI element.

I've been coding Java in the portal for some time but I'm somewhat new to WebDynpro so I don't know the API's very well yet.

Thanks for the idea,

Patrick.

Answers (0)