Section Introduction
This section gives a comprehensive analysis on how to work with forms in a Rails application. This includes the various forms Rails provides, along with how to build JavaScript based dynamic forms.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

When it comes to getting user input being able to effectively use web forms is incredibly powerful. And in this section, we're going to take a much deeper look at how to use forms in Rails. Up to this point, we have integrated a number of forms but they've mainly been generated for us. So in this section, I want to go take a much deeper look at how we can work with forms and see how they're working underneath the layers that Rails gives us. So we're going to talk about security. We're going to talk about how we can build forms completely from scratch and we're also going to go into how we can incorporate javascript into our forms. If you remember back to when we implemented nested attributes and we set a fixed number of optional fields. Then you remember that I told you we were going to come back and we're going to make those look much better. That's what we're going to do in this section, we're going to see how we can incorporate javascript to give a dynamic number of nested fields so that users can pick and choose how many extra fields that they want. That is very important when it comes to implementing dynamic forms. In modern times users don't really expect to see a set number of form fields. They're used to forms being able to adjust based on the input that they give to it and that's what we're going to go through in this section.