Quiz
- The jQuery is a bit confusing
Sorry about that. Maybe we can talk later, in class or in OH?
The basic idea is that we can do the following using JS:
- stop the "normal" form submission (which brings the browser to a new page, which might not be ideal UX)
- process the data using JS, including
- sending data to a server and
- getting data back and
- updating the page with that data
- I want to learn about some more complex ways that JS can interact with forms to enhance user experience, such as interactive error messages or validation.
Great question. This follows up to the previous one.
For example, we could detect that someone has chosen their home state and replace the drop-down menu of high schools with a list of high schools in that state. This customizes the form for the user, improving the UX.
I saw Facebook do this two decades ago, and it still seems cool.
You would be able to do that in your projects, either keeping (1) 50 lists of high schools in the browser, or (2) making an Ajax request to the server to retrieve the list of high schools for the user's choice.
Here's another example: in a "signup" form, checking whether a username is available while the user is filling out the password field.
- Why would structural approach won't work for page layout?
Because it forces the text and the input to be parent/child. That mostly works, but there are some layouts (such as a two-column table), where it won't.
In that case, and almost only in that case, I would use the
for/id
approach. - All good for now! Excited to learn how we can play around with data received from the form in the future.
Great!
- This reading makes sense! x 5