on 11-04-2010 10:05 AM
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you give me a code example? I still have problems to understand the approach.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.