cancel
Showing results for 
Search instead for 
Did you mean: 

Open a form at a special Position

Former Member
0 Kudos

Hi,

I have a form with many inputfields. If I click on a Save-Button, the form will be saved, and the form jumps to the beginning of the form.

Now I want this: If the User changes something in the inputfield x and saves, the form should stay at the position of this inputfield.

Do you have an idea to solve this problem?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can achieve this by doing the following:

1) Keep track of the last-changed input field, by reacting to the OnChange event.

2) When the data is saved, set a flag. In the view's wdDoModifyView() method, check this flag and if true, then perform the following code:


.....
if( dataSavedFlag )
{
     IWDInputField lastInputField = (IWDInputField) view.getElement( last_input_field_name );
     lastInputField.requestFocus();
}
.....

Regards,

Walter

Answers (2)

Answers (2)

Former Member
0 Kudos

Can you give me a code example? I still have problems to understand the approach.

Former Member
0 Kudos

Hi,

What version are you using? - As per NW7.0, you will not have any handler to do what you want.

In CE versions, IWDAbstractInputField exposes setOnChange which will perform an action when the UI Component loses its focus. (leave the field)

Even when running CE, you'd not have the expected behaviour (which is HTML event onFocus and not onBlur as offered by CE) - so your alternative would be injecting jQuery or JS using an iFrame and appending these HTML event's (you can also trigger a roundtrip, just try to understand the action pattern reading the source code) as you may want to store the UI Component name in a Context value.

When I was asked something similar, even thou I achieved the expected results using solution above I did not implement or deployed this code, as this goes against what WDP stands for... Unless I'm very wrong, I would just recommend you "pushing back" with a "WDP limitation" note.

Hope it helps,

Daniel

Former Member
0 Kudos

Ok, but how can I develop the onChange Event?

I don't know how to develop this part: "Keep track of the last-changed input field, by reacting to the OnChange event."

Is it only possible at a special Service Pack or someting else?

Edited by: stefan1983 on Nov 9, 2010 10:36 AM

Former Member
0 Kudos

The onChange event is available (as is an onEnter event). If you provide an event handler for one of these events, a backend round-trip is initiated.

Walter