Thomas Chase

Case Study Explanation

For my individual case study project I am building a Motorcycle Safe Route Planner. To ride safely on the road it is important to keep track of maintenance but what if we could add another layer of protection by creating a safe route maker! Below is an explanation of how things are going so far and how this project should be graded.

Chapter 4: Exception Handling

For this chapter I added try catch blocks to my route makers search menu. When you enter a location into the start and end input fields the code tries to fetch coordinate data from an external geocoding system. If that request that is sent out fails or you dont have Wi-Fi the catch block intercepts that error and instead of breaking the entire website it logs the error to the console. This keeps the website running smoothly.

Chapter 5: Object-Oriented Programming

For chapter 5 I made it so it would display the users info about their display and brower. I also displayed and talked abou tthe safe web browsing resources and made some links to those.

Chapter 6: Form Validation

For this chapter I added validation to my pre ride and maintenance tracker form. This form uses three different field types that consist of a text box that is the odometer, chekboxes that are the safety checks, and a text area for notes. The JavaScript intercepts the form submission to verify that the odometer has a numeric value greater than zero entered. It checks that at lease one of the safety checkboxes are selected and that the notes section is not left blank. The user can not submit the form until these checks are satisfied. If they are not satisfied then it displays a red error message. If they are satisfied then it will display a green success message.

Chapter 7: Array Manipulation

For this chapter I added to my motorcycle maintenance tracker form adding the pre ride safety checkboxes. I added an event listener that detects whenever a user interacts with the checkboxes. It takes all the selected options and maps them into a JavaScript array called selectedCheckArray. If the user deselcts an option the array will automatically remove it. The code also uses the join method to convert the active array into a single comma seperated string. It then displays the sucess message whenever the form is submitted.

Chapter 8: Object-Oriented Programming

In this chapter I created a custom object class called MaintenanceLog. This was created to handle data submitted from the maintenance form. To keep the code flexible the class and constructor function are located in a seperate external js file. Whenever a user submits the form the main script creates a new instance of the MaintenanceLog. This uses a custom method that is tethered to the object (MaintenanceLog) to log the final data.