Let's force the user to enter at least 5 characters when entering comments for the punch list item they want to save (We realize this is not the most practical validation, but it serves as a good practical example). To do that, we are going to add a custom validation in the JS that we will execute before we save and dismiss. Checking the length of the comments field is pretty easy in JS, since it is a string we can use the
.length property. So, we want to validate that the length is at least 5 characters long, if not, we want to give the user a notification telling them what is wrong and also stop the code from saving the item and dismissing.