From the course: Building React and Django Apps
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Creating form fields for basic form
From the course: Building React and Django Apps
Creating form fields for basic form
- Now let's update the form field component. It's a self contained component where data is passed in for display and changes to the field are propagated upwards to the containing checkout component. We're going to display the name, the label, and the value. And propagate changes up through the onUpdate callback. We're going to create the onChange callback which will call onUpdate with the field name and the updated value. We rendered the label and then the input for the form field. The name, the value, and the onChange callback. Let's run the development servers. We can see how this looks by adding an item to the cart and you can see that our checkout form has all the fields there and it shows the item that we will be ordering. But it doesn't have any styling, so let's fix that. We open checkout.css for the checkout forms styling. We're going to set it up using a flex layout, the direction will be column and we set up some…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Handling creating models with Django REST framework1m 39s
-
Creating a REST API Service class with React and Axios2m 24s
-
Creating a basic form as a React component2m 22s
-
Creating form fields for basic form2m 6s
-
Connecting a React component to a service2m 26s
-
Validating form data with Django REST framework54s
-
Displaying validation errors with React1m 23s
-
-
-
-