Learn how to make a validation rule that prevents submission and tells the user why the form cannot be submitted.
- [Female Voiceover] Some people just don't pay attention. It doesn't matter how many messages I give them on this form, they are still going to try to submit something that's just not right. In this case, we've got a hidden calculated value that figures out if the person's submitting a travel request within 14 days of when they want to travel. If they've done that, then we're giving them a message that says hey, your departure date is too close to today's date for online booking. But if I go to hit save, it's still going to allow them to submit this form, so here's how we have to fix that.
We need to go into start date and add a rule. All right, I'm going to name this DatesBad. And this is not a formatting rule, this is a validation rule. All right, are you ready to reuse our form variable? 'Cause that's what we're going to do! I'm going to click on my function and I'm going to say if named control DatesInRange is equal to not allowed... Heh heh heh, heh heh, click okay.
Then, okay here is something really cool, my InfoPath people are going to love this. We can put in a custom validation message that says, once again, I told you... Cannot book online if departure date is within the next 14 days. Let's go try it out. Doo do-doo do-doo, you're departure date is too close to today's date. I don't care, do it anyway! So fill in your required field. Save.
Heh heh heh, heh heh heh. Cannot book online if departure date is within the next 14 days. I love being able to send dynamic messages to folks as they fill out the form using these calculated fields. But for those bad apples in your cart, you can still make sure a list item isn't created if the data they entered is bad.
- Formatting in Forms Designer
- Using Format Painter
- Configuring form controls
- Using functions, variables, calculations, and other form logic
- Design responsive views
- Adding buttons for form submission
- Importing and exporting forms
- Resetting and deleting forms