Input text is gone when user enters text before JavaScript is downloaded - best practice?
See original GitHub issueHey guys, when I’m using FastBoot and user enters text into inputs in my form (BEFORE JAVASCRIPT IS LOADED), and then tries to submit it - Ember empties input elements.
I’d like to ask for best practice how to deal with such situations? Should I show input fields in didInsertElement
hooks? Or is it possible to show some kind of spinner before Ember is fully loaded?
Thanks, really appreciate the work which has been done over the years in Ember!
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Selecting all text in HTML text input when clicked
A better approach is to use a <label> for the label and not the value . You can use JS and CSS to...
Read more >Handling common JavaScript problems - MDN Web Docs
In the Search packages text field, type "jslint" and press Enter/Return to search for linting-related packages. You should see a package ...
Read more >JavaScript best practices - W3C Wiki
Writing a best practice article is quite a tricky business. ... which is a compilation of best practices and good advice I've amassed...
Read more >Chapter 1, Writing Your First JavaScript Program - O'Reilly
In your favorite text editor, open the file hello.html. This file is located in the chapter01 folder in the MM_JAVASCRIPT3E folder you downloaded...
Read more >Introduction to browser events - The Modern JavaScript Tutorial
For instance, to assign a click handler for an input , we can use onclick ... Add JavaScript to the button to make...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FWIW, I was just working on a solution to the same problem. So far I followed this approach:
value
, and focussing the previously focused input (if any)<form onsubmit="alert('Please wait message'); return false;">
, which will prevent form submission until the Ember app has taken over.I have already prepared this as an in-repo addon, might publish this if it makes sense to you, and after some cleanup/docs etc.
@Kuzirashi Here you go: https://github.com/kaliber5/ember-fastboot-form-rehydration
It’s at an early stage, definitely needs some more love (i.e. tests), but feel free to try it out! It does not cover case 3 mentioned in https://github.com/ember-fastboot/ember-cli-fastboot/issues/560#issuecomment-351093606, as we did that in our app code itself. But might be possible to even integrate that into the addon as well sometime…
Feedback certainly welcome, but let’s move that to its own repo! 😉