Now that Kyle has the shared data validation module written, he adds some input boxes that will need the validation. He also adds some client-side logic to handle incorrect min and max values.
- So now, we want to do that same kind of check…and call logic in the about,…but first we need to give a way to specify those,…so let's come to our template, our about grips template,…and let's add in a couple of input boxes.…
So, we got two input boxes…that you need to be able to set some numbers into.…So, in our init function...…This function's already starting to get long,…so I'm going to refactor by pulling that out.…Somebody just said foo.js is wrong.…Yup, it does. Good catch.…
Thanks, Vincent.…We would have found that eventually, I'm sure.…Alright, so, I was pulling out that function…instead of using an inline function,…I want to make that it's own thing,…'cause I'm going to be adding stuff to it.…
Okay.…Let's get our min and our max out.…
First step, before we try to make the request,…is we want to do our validation, right?…So, I want to invoke that validate function.…I want to say if Validate.checkMinMax.…Question is, can I share all this code that I'm writing?…Absolutely.…We'll make this available as well.…
Note: This course was created on 03/29/2016 by Frontend Masters. We are pleased to host this content in our library.
- Carousels, panes, and modules
- Middle-end architecture
- Secure phrase generator
- Routing functions
- Calling the API
- Rendering on the page
- Shared data validation
Skill Level Intermediate
2. Organizing Code
5. Adding a Shared Module
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.