Web App: Home Forms
Configuration Challenge

This is your opportunity to apply everything we learned in making the color form. Creating the configuration form involves the exact same steps we went through for the color form, so try doing it on your own. You’ll need to

Make a route for when the user submits the form
Edit the settings model to store the thresholds
Add the form to the template (EJS file)

The next lesson is a solution to this challenge, but you’ll learn best by applying this new information on your own. Give it a real try before looking at the solution. Here are the specifications, with some hints.


When the page loads, the form fields must populate with the currently saved values
When a user submits the form, it should update the settings document with the new thresholds and then redirect to home
The form should take up one line, as in the picture
What happens if you try to read a field that doesn't exist (for example, reading the threshold for Cold before you've ever saved it, so it doesn't exist yet)
There is an html tag <br> that creates a line break. Or you can use custom css to help adjust any displeasing formatting
There things called html tags for special characters. You can make a degree symbol by typing & deg in your EJS template (without the space between the ampersand and 'deg')
Look up the Semantic UI documentation for forms. The even show code for their examples, which you'll find if you click around a bit (their documentation is user friendly). You may want to look at inline fields.

Go forth and code!