Re: Refload page on typing without losing focus?
Esteban Maringolo <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <CAJMgPCLedD5yQwwqgGJxitcWjCXu1qbVKXFN=inT3smG3uMchw@mail.gmail.com> |
Bob, Who is "we" in your statement? :) In any case, the overall interaction would be somewhat clumsy, because you have to wait for the full page reload (AJAX or not) and then focus the proper widget, it is not the same to lose the focus (blur) by pressing tab, than by pressing a random element in the DOM. I had to do the opposite, be able to update the content of a grid of inputs without reloading them to preserve the expected keyboard navigation, and I resorted to a set of helper JS functions that get called in my event handlers (change, blur, etc). The result interaction is very flluid. In any case I don't see why you need to reload the whole page and not parts of it. Regards, Esteban A. Maringolo El mar., 26 mar. 2019 a las 9:09, Bob Nemec (<[email protected]>) escribió: > > We do refresh onBlur, so having the user's focus on the widget they selected after the onBlur + refresh was needed. When a widget gets focus we set a global value onFocusWidgetId to the widget id. The on the refresh we include a load script that checks for a non-null onFocusWidgetId value which is not equal to document.activeElement.id and sets it using document.getElementById(onFocusWidgetId).focus(); ... similar logic is used to set the cursor position within an input field, otherwise the cursor is set to the start of the field, even if a user clicked elsewhere. > > Bob > > > On Monday, March 25, 2019, 4:42:34 p.m. EDT, Johan Brichau <[email protected]> wrote: > > > That’s not really possible. > > If you want to keep cursor position and keyboard focus etc… you can only do that by _not_ refreshing the input field itself. > i.e. use Ajax updates for the other elements you want to update… > > cheers > Johan > > > On 25 Mar 2019, at 20:27, Bernhard Pieber <[email protected]> wrote: > > > > Hello, > > > > I managed to show a validation message beneath an input field of type text on every keypress using jQuery. In this case I knew exactly which DOM element to change. > > > > Now I would like to refresh the whole page on every keypress without having to know which DOM elements need changing. In the keypress callback I change some state and then I would like to rerender the page like it would when using renderContentOn:. > > > > I know how to trigger a page reload. However, the challenge is to keep editing the input field, i.e. the keyboard focus, the cursor position and the text selection. > > > > Is this possible somehow? Any help would be appreciated. > > > > - Bernhard > > _______________________________________________ > > seaside mailing list > > [email protected] > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > _______________________________________________ > seaside mailing list > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ > seaside mailing list > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [email protected] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside