Introduction

This blog is mainly focused on SharePoint
I will use this to store and share all the tips and tricks about SharePoint and the related products
List of all posts

SharePoint and InfoPath Form


Topic Customizing SharePoint Form with Infopath (with test between dates)
Output Infopath form

Step Description
1From your navigator, select list in the top navigation
2
In the list ribbon, select the InfoPath Icon
3Your form is now open in Infopath
4We want to test that the end date is greater or equal to the start date
5First we add a valition rule the start date (not an empty field)
6Then we do the same for the End Date (not an empty field)
7So with both field not empty, we can add a rule that will test if End Date is greater than the Start Date
7aUsing the "Expression" test
7bWith the following expression :
number(concat(substring(../my:End_Date, 1, 4), substring(../my:End_Date, 6, 2), substring(../my:End_Date, 9, 2))) - number(concat(substring(../my:Start_Date, 1, 4), substring(../my:Start_Date, 6, 2), substring(../my:Start_Date, 9, 2))) < 0
8Publish your form
9Now you can test your form in SharePoint, if you don't respect the rules, you will not be able to publish it
Bad fields are in read :
and when you pass your mouse over it, you've got information about the error
Now you have an edit form with controls prior to posting.

No comments:

Post a Comment

by Category