Validate a form? Yup, I can do that.

Validate a form? Yup, I can do that.

Yup is a schema validation library. One would use it to add property validations that execute prior to form submission. It is also pretty easy to use, it’s just difficult to find concrete examples to model off of.

Yup is a schema validation library. One would use it to add property validations that execute prior to form submission. It is also pretty easy to use, it’s just difficult to find concrete examples to model off of.

Because of this difficulty in finding good examples that showcase its syntax, I’ve compiled some common examples in Javascript.

Let’s start with something easy and build from there.

Schema Structure

First, you need to know the basic structure to use.

Image for post

Sample: Structure of schema validation

Here are a couple of samples for different data types:

Image for post

Sample: First name is required

Image for post

Sample: Birth Date is required

Custom Error Message

You can customize the error message that is displayed on the form.

Image for post

Sample: Custom error message for first name

Enforce Data Type

You can also enforce that the data entered in the field corresponds to a particular data type. You can specify a particular message to be displayed when the value entered is not a real date.

Image for post

programming yup javascript front-end-development web-development

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Top 19 Front-End Web Development Tools to Consider in 2020

In this post, we are putting curated list of top tools with key features and download links "Top 19 Front End Web Development Tools to Consider in 2020"

Top 6 Productivity Tools for Front-end Developers

Today I wanted to share with you the tools I daily use to increase my productivity as a front-end developer. 6 tools to increase your productivity as a Front-end developer.

Top 9 Open source JavaScript frameworks for front-end web development

About a decade ago, the JavaScript developer community began to witness fierce battles emerging among JavaScript frameworks. In this article, I will introduce some of the most well-known of these frameworks. And it's important to note that these are all open source JavaScript projects, meaning that you can freely utilize them under an open source license and even contribute to the source code and communities.

Front End Web Development Project Tutorial for Beginners

In today's front end web development project tutorial we will talk about rotating shapes, images and particles with plain vanilla JavaScript on HTML canvas. Today we will build a beginner friendly particle system project together from scratch and in the process we will learn how to replace particles with images using draw image canvas 2d api method and how to make these images rotate around using 4 built in canvas methods - save, translate, rotate and restore. Let's bring our HTML canvas projects to the next level by mastering these techniques, welcome to another episode of my vanilla JavaScript creative coding series.

How to Master the Front-End Development

Learn how to focus your skills to become a master at front-end development. How to Master the Front-End Development. A few years back doing front-end work, especially on the web, was rather simple compared to the back-end where all the app logic used to reside. Nowadays, that has changed. Front-end development has evolved thanks to powerful frameworks and libraries supported by the evolution of the browsers and their respective APIs.