⚠️ This lesson is retired and might contain outdated information.

Limit or Control What gets Input into a redux-form Field using normalizing

Rory Smith
InstructorRory Smith
Share this video with your friends

Social Share Links

Send Tweet

Sometimes we need to add a limitation to what the user is inputting into a redux-form Field. For example, in a license plate lookup, we want all the letters to be uppercase regardless of whether the user types them in caps, or when taking a user’s name, we may want the format to be capitalized.

Instructor: [00:00] Using Redux Form, we can use normalization to format the user's input. For example, we could ensure that the user's first name and surname are capitalized, regardless of how they type the values into the fields.

[00:15] The demonstrate this, let's go ahead and add capitalize as a dependency. We can import that in our register form. Now, we can use the normalize prop, and pass in the capitalize function. Let's apply this to the first name and the surname. Of course, you could pass whichever function you wanted in here.

[00:45] Let's save and refresh now. Now, even if I type everything lowercase, the values are capitalized.