SPEasyForms is a GUI tool for applying jQuery constructs to Out of Box (OOB) SharePoint forms without necessarily knowing anything about JavaScript or HTML or CSS. You configure SPEasyForms through a drag and drop IDE-like list settings page, which is available on the list ribbon or as a link on the list settings page of compatible SharePoint list types (currently all lists except Surveys and Discussion Boards) and libraries. The things you can configure fall into 3 broad categories:
Most of the things marked (NEW!) were actually released in the updates package to v2014.01. The Stack and Star Ratings Adapter are actually brand new. Other than that, most of what's changed in v2015.01.01 is:
The rest of this user manual will consist of an Overview section (system requirements, installation, and a laundry list of UI buttons and views), and sections for Themes, Containers, Conditional Visibility, and Field Control Adapters. In those last 3 sections, we'll follow a scenario (i.e. state some basic requirements and how those requirements can be satisfied using SPEasyForms). This scenario will be a Contacts list with multiple content types (Contact and Employee).
People learn differently. This section is primarily reference information. Some people want to scan this first to get an idea of what's available for the 10,000 foot view. Others want to jump right into using the thing and go back to the reference material on an as needed basis. I've chosen to put this up front in my document, but if you fall into the latter group and you already know how to install a sandbox solution, you can certainly skip this section and jump to section 2. Themes. If you just need help installing it but then want to jump in, read the next two brief sections and then skip to section 2. Themes.
SPEasyForms was developed to run on Office 365 and SharePoint 2010 and 2013. It has been pretty well tested on all three platforms, meaning all of the functionality has been tested on all three platforms, but not necessarily on every list and library type available on all three platforms. Testing was done with Internet Explorer 9, 10, and 11, as well as Microsoft Edge, Firefox 24, 28, and 32 and Chrome 35. That does not mean those are the only browsers we plan to support, but there is a limit to how many browsers a small team can reasonably test. If you find an issue with a particular browser, report it in the issues list on CodePlex and we will address it as quickly as possible. There are no plans to support SharePoint 2007.
In order to install SPEasyForms, you must be an SCA. SPEasyForms installs all of its scripts and resources in the Style library. By default all users in the site collection can see files in the Style Library. If you muck with the permissions in this library, users who cannot read these files will not see any of the changes you configure with SPEasyForms. Also, mostly on SharePoint 2010, the Style Library defaults to force checkout of files before editing, and all of the files will automatically get checked out during installation. Nobody else will see these files until they are checked in, and there are hundreds of files so you don't want to have to check in these files manually. To get around this, you should turn off force checkout on the Style Library before installation.
To get started, download the latest recommended release from https://speasyforms.codeplex.com and follow these steps to install it:
Now that wasn't too painful, was it? To confirm that it appears to be working, go to a list in your site collection and look for a button in the Settings panel of the List, Library or Calendar ribbon labeled SPEasyForms:
Click on the the icon and you should see the SPEasyForms Settings page, pictured in the next section.
If you've gotten this far, and the settings page looks OK, the thing is installed. If you've already encountered a problem, go to CodePlex and open a new thread in the discussion board with your issue. I generally try to respond pretty quickly, and as I build up a list of frequently encountered issues I'll update this document with a troubleshooting section.
The list settings page is pictured above. It is comprised of four parts:
This section is just a laundry list of the ribbon buttons intended primarily for reference. Most of the functionality of SPEasyForms is exposed through the following ribbon buttons:
The left-hand side of the main content area is the properties pane. Most of the configuration of SPEasyForms is done from the properties pane. It contains a gray box per container, with the name and container type as the title. You can collapse all containers (i.e. show only the title) using the buttons on the ribbon. You can also collapse/expand individual containers by clicking on the triangle icon in the upper left-hand corner, or collapse/expand a container and all of it's children by double clicking on the container.
A container contains one or more sub-containers, used by the container in a container specific manner. In other words, the tabs container draws one tab per immediate sub-container, and puts each sub-container on the appropriate tab. The sub-container name or title is also used as the tab name in the form. The columns container creates a table with X columns where X is the number of sub-containers, and puts each sub-container in the appropriate column. The sub-container title is not displayed at all in the form for a columns container, it is only displayed on the settings page.
Ultimately, at the leaf nodes, a container usually has a special sub-container called a field collection, which is just a logical grouping of fields. You can drag and drop fields within or between field collections. When the editor first opens for a list that has not been configured before, all of the fields appear on a special container call the DefaultForm container. This represents to out of the box SharePoint form.
You can also drag and drop containers to reorder the tabs on a tabs container for instance, or to make one container a sub-container of another container. There are some restrictions however. The default form, html snippet container, and field collections cannot have sub-containers. The default form also cannot be a sub-container; you can move it up and down at the top level but you cannot put it on another container. Finally, a field collection cannot stand alone (i.e cannot be a top-level container), it must be a sub-container. If you try to drag something to a place where it cannot be dropped, the placeholder turns red. If you drop it anyway, it returns to its original position.
Getting comfortable with the different ways to collapse things in the properties pane is important because you move fields between containers and collections, reorder fields within a collection, and reorganize containers by dragging and dropping them. When you have a lot of fields, and containers, and field collections, and you want to move something from the bottom of the form to the top, it is a lot easier if you collapse stuff that is between the containers with which you are currently working.
The containers also have icons that perform specific actions depending on their context/scope (i.e. the icons are generally to the right of what they configure or on the title of what they configure, and can be for configuring the container itself, or an individual field). These buttons are described in the following table:
Button | Scope | Description |
Container | Configure the container. You can change the container name/title and/or add field collections to the container. | |
Container | Delete this container, all fields that were on the container (or a sub-container) are returned to the default form. There is no confirmation, but you can always undo. | |
Field | Configure field visibility rules for this field. | |
Field | Add or configure the field adapter for this field. If there are no field adapter types available for a particular field type, this button will be missing next to fields of that type. |
The ribbon button for configuring SPEasyForms for a list is security trimmed and you need to have the Manage Lists permission in order to see it. But that's not really security, it's security trimming.
So the next question is, what are the security considerations you should be aware of when using SPEasyForms? SPEasyForms security is entirely based on file system security, meaning that what a user can do with SPEasyForms is based on the SharePoint permissions assigned to the files that SPEasyForms depends on.
These files fall into two broad categories:
Just keep in mind that the actual security is based on the permissions of the files and you can lock down SPEasyForms however you like. You can even give a non-privileged user the ability to modify the SPEasyForms configuration for a given list just by breaking role inheritance on the configuration file for that list, explicitly giving them write access to it, and sending them a link to the settings page for that list (since they might not see the security trimmed links to the settings page).
So after installing SPEasyForms the first thing you should do is lock down these files by:
SPEasyForms is intended to work on the OOB new, edit, and display forms for most list types. It does not work on Discussions or Surveys, and there are other list types where exhaustive testing has not been done. It also does not allow you to configure content types based on folder. Folders rarely have enough metadata to require such a solution, but the bigger issue is that Microsoft subclasses folders for some pretty strange content types (like document set or OneNote document) that are so different from other OOB list types. It would nearly double the code to deal with them.
The reason for these limitations is fairly obvious, in that SPEasyForms modifies the OOB forms by directly manipulating the Document Object Model (DOM) and/or applying CSS to DOM elements. That means it needs to make some assumptions about the structure of a document. But SharePoint, and particularly SharePoint designer, allow you to customize the DOM to your hearts content. And in the case of lists like Surveys, Microsoft has modified the DOM themselves enough that the OOB form does not look much like the DOM for a generic list. For instance, SharePoint normally produces forms that consist of a table with a row for each field. But you can modify the XSLT for a DataFormWebPart such that the fields are displayed as floating divs with fixed positions and there is no table whatsoever. And there's technically nothing wrong with that, but you will certainly have made the form unusable by SPEasyForms because you've broken the parser. The rest of this section will attempt to describe the DOM elements and structure on which SPEasyForms depends. If you are not going to muck with the structure of the form at all, you don't really need to worry about these details.
So the basic constraints are as follows:
These constraints are all met by most OOB list forms. They are not met, however, by SharePoint designer generated custom forms, unless you do some manual messaging of the generated XSLT. I have updated the DOM parser such that it can deal with SharePoint designer generated forms assuming you haven't mucked with the XSLT too much. The constraints for designer generated forms are as follows:
OOB designer generated forms meet these constraints. If either of these lists of constraints are met by your forms, they should work with SPEasyForms.
Anyway, now that you've got it installed, and I've finished the overview, it's time to start looking at our scenario and take it for a spin.
By default, SPEasyForms uses the Redmond theme for jQuery UI. Even constructs like the Columns container and Stack container, which are not part of jQuery UI, uses jQuery UI classes to be consistent. The Redmond theme was chosen because it looks reasonably well with unaltered/out of the box sites in both SharePoint 2010 and 2013.
But if we could live with unaltered SharePoint sites, we could probably live with unaltered forms, and SPEasyForms would serve no purpose. Most production sites have had some custom theme work done, so it would be hard to argue that the Redmond theme will look good on your site.
One of the common requests for version 2014.01 was how do I change the theme. The only way was to overwrite my theme in the Style Library/SPEasyFormsAssets/Css directory, which changed the theme for every list in the site collection. That's changed in the latest version. You can configure the default theme for the site collection or the theme for an individual list through the user interface.
With 2015.01.01 and later, you can configure a different jQuery UI theme for each list. On the settings page, hit the Settings button. You will see a form that looks like:
If you click the Use Gallery Theme radio button, you'll have a drop down of 6 themes included in the release:
Choose salmon, hit the apply theme button, and go to the form view and you're interface should look something like this:
Note that in addition to re-theming the form, you've also re-themed the editor itself. That's because I'm using mostly jQuery UI classes to theme the editor. In order to see the changes in the actual form, you need to hit the Save button. Now if you go to the form (you may need to clear your cache and refresh) you'll see something like:
Now I'm confident that these 6 pre-canned themes are going to meet all of your theming needs right? Ok, I'm actually sure I could have included 60 themes and that still wouldn't be true. And I'm definitely more of a developer than a designer. That's what the third radio button is for:
With this option, you can point me at any jquery-ui.css file and apply it as a theme (assuming you've got all of the other files needed by the theme with it and in the appropriate directory structure). If you put in a path and hit apply theme, and either nothing happens or it goes back to Redmond, it means the browser could not find your theme, i.e. there is something wrong with your path. Go directly to jail; do not pass go. Or, fix your theme and try again. Again, you need to hit the Save button to make the change permanent and see it in the forms.
If you've uploaded your theme to SharePoint, you can use ~sitecollection or ~site to represent the path to the current site collection or site respectively. Before trying to load the style sheet, SPEasyForms will replace these tokens with the appropriate path. This is useful because you can move a configuration between a developer farm and production and it will still work (assuming the theme is in the same place on each farm). But of course, the theme does not have to be stored in SharePoint; you can even load it from a CDN assuming your users will be able to access the CDN when they're using the form.
Finally, you can set the width of the SPEasyForms outer container. The default is 800, but depending on the design and complexity of your form and list, you may have to play around with this until you find something that works. In my form, I've set this to 700. If I set it any smaller I'll start seeing weird glitches like scroll bars in the accordion content, or the content of tabs overrunning the edge of the tab.
You must be a site collection administrator to change the default theme for the site colleciton. To do so, go to the site settings page of the root site for your site collection. Under the Site Collection Administration heading, click the link that says SPEasyForms, and you should see the following page:
This looks very similar to configuring a list in the editor, except there is no option to revert to the default theme, because the default theme is what you're configuring. Just choose one of the six gallery themes. Or choose use custom theme and enter a path to the jquery-ui.css file. Again, you can use ~sitecollection in your path if your theme is stored in the current site collection. So if I choose use custom theme and enter the path '~sitecollection/Style Library/jquery-ui-peppergrinder/jqury-ui.css' for the path, save it and open the settings page for a list that isn't configured to use a non-default theme I see:
and...that...doesn't...look...right at all? This is jQuery with no CSS applied. It still functions, but it doesn't look very good. The reason: if you look at my configuration above I've spelled jQuery wrong in my path. I demonstrate this because I know it's going to happen and showing what it looks like may help (if anybody actually reads this). Anyway, if I fix the path, clear the cache, and refresh the editor I get:
Which is a bit more like what I was expecting.
Also note that there is a large text area called additional files to load. I can specify additional JavaScript and CSS files to be loaded on every page in the site. This was intended to provide an easy way to install SPEasyForms AddOns in the future, without the need to install a hotfix sandbox solution, but it can also be used as a sort of Swiss army knife for designers that want to tweak forms a little more than SPEasyForms will allow. Buyer beware though, before loading files in this way, you must understand:
In general, before loading any files like this in a production environment, you should test them in a non-production site collection to ensure that they are stable and provide the functionality desired.
As mentioned previously, the rest of this document is going to follow a scenario, starting with a list and some requirements, and showing how SPEasyForms can be used to satisfy those requirements. This section will describe the list that will be the starting point for our scenario.
I generally start regression testing with a Contacts list, because that's an OOB list type that has enough fields that the form looks pretty bad as is and could use some restructuring. In order to demonstrate all of the current capabilities of SPEasyForms, I'm going to make the following changes to the list:
These last 3 fields are to demonstrate cascading look ups, which we won't get to until section 4. Field Control Adapters. I'll describe the reference lists in more detail when we get to it, so if you're not sure how to set them up you can skip it until then. However, if you've ever setup cascading look ups for SPServices before, it's just like that because I'm using the SPServices library to implement cascading look ups.
Anyway, now that we have all of this stuff configured, go to the new form for an Employee:
I know what you're thinking...p r e t t y my p r e c i o u s! That brings us to the first requirement for our scenario:
Now I'll be the first to admit this isn't a very good requirement, but if you've been working in this business for a while you probably recognize it as a pretty common one. So you resist the urge to call the customer stupid and start pitching ideas. Maybe we could organize some of the fields into tabs? You start white boarding and come up with a design that the customer seems to like. Maybe pretty is going a bit far but it's hopefully more visually appealing and functional at least. That's what containers are all about so lets configure one.
The columns container just lets you organize fields into two or more side by side columns (technically it can be 1 or more, but 1 column doesn't really gain you much). To add a columns container:
* Note: nothing is actually required for this dialog. If I just hit Ok, it will create an empty columns container named Columns. I used to require you to enter at least one column name in order to create a field collection, because a container without fields didn't make a lot of sense. But now you could create a columns container that had two columns, the first a tabs container and the second an accordion container, and put the fields on those containers. And since those containers have to be created separately and dragged onto the columns container, it might make sense to create an empty container.
* Note: The names of the columns doesn't matter much because they're not actually displayed on the form for a columns container. If this were a Tabs container, the names would be used to label the tabs, so they would be more significant.
The settings page should now look like this:
The first thing to notice is that nothing really changed on the WYSIWIG side of the form. You might think you just need to scroll down and you'll see columns, but trust me nothing changed. This is because containers that have no fields are hidden. This is a trick that you can use to your advantage when configuring multiple content types for a single list, but I'll save that discussion for the end of this section.
In the properties pane, however, you'll now see 2 containers, the second one being a columns container with two empty field collections. Once you have more than one container, you can reorder the containers via drag and drop. In the picture to the right I've dragged the columns container above the default form (after collapsing all containers, I might have mentioned how to do that earlier). The blue dashed box below the hovering container is called a placeholder and indicates where the item would be placed if you let go of it right now. If the fill color of the placeholder is red, it is not a legal place to drop the current item. If you drop it anyway, it is returned to it's original position.
There's still no change to the WYSIWIG, to see it there you have to put some fields in at least one of the two field collections so lets start doing that.
First expand the containers. Now you can drag fields from the default form and drop them on the field collections in the columns container. You can drag fields from any field collection to any other field collection, or even reorder the fields within a field collection via drag and drop. You can only drag fields one at a time, which can be a little tedious but you have to admit it's still easier than coding a custom solution. I may try to implement a multi-select drag and drop in a future version, but for now it's one at a time. I'm going to put a few fields in each column, after which my settings page looks like this:
Now there are some changes to the form view. I have 6 fields arranged in 2 columns followed by the default form. Of course the form view isn't really a WYSIWIG, it's just structurally close. It doesn't draw any input controls, the boxes on the right-hand side are just the form body table cells with some CSS to give it a border, which becomes apparent when you see the columns container in the form view, because the field labels move inside the box. In addition to moving the fields into a multi-column table, the columns container moves the field label into the form body cell placed above the input control to save horizontal space (if there is more than one column). It also applies some CSS to shorten ms-longinput controls, when and only when they're on a columns container, again to save on vertical space. To see what it really looks like you need to open up the new form on the list again, but first hit the save button in the editor or you'll be utterly underwhelmed by the dramatic lack of changes to the form. Once you've saved, the new form should look something like this:
I would be lying at this point if I was to say that we'd achieved anything even close to pretty, but we're making some progress and it took a lot less time to configure it then it took to write this section. But the real power of containers is that you can put as many as you want on a page and mix and match them any way you want. To demonstrate, add another columns container to the form with 4 columns, drag it just below the first columns container, and add the four fields Code, SalesRegion, SalesDivision, and SalesState to it, one per field collection. Save it and refresh the new form and it should look something like:
Again, its not particularly sexy, but it's starting to show some potential. With just the columns container I can create a wide variety of grid layouts, limited only by the horizontal size of the controls and how wide I'm willing to let the form get. And let's face it, everyone knows most user's have a display with more horizontal real estate than vertical and nobody likes to scroll (at least maybe everybody except the guys at Microsoft who wrote the first SharePoint forms ;).
Anyway, the basic idea behind containers is to organize fields in a way that maximizes screen real estate, and the Columns container provides some ability to do just that. But the other containers, tabs and accordion, have even more potential to maximize screen real estate, so lets quickly see how they work.
Tabs are configured in the same way as columns in general, but in this case I'll use them to briefly show nested containers. The tabs I'm going to configure look like this:
Tab Name | Fields |
---|---|
Address |
Address City State/Province ZIP/Postal Code Country |
Phone |
Business Phone Mobile Number Fax Number HR |
HR |
Leave the HR tab empty for now. Each of these tabs will be a two column display. Start by adding an empty tabs container, and two 2 column columns containers named Address and Phone. Then drag the address fields onto one of the Address columns and the phone fields onto one of the Phone columns. When you're finished, the editor should look something like this:
All of the containers are at the top level at this point, nothing is nested (except the field collections of course which are always nested). What I want is for the Address and Phone containers to be tabs on my Tabs container. To achieve that I need to grab the Address container and drag it right until I see the placeholder indent, and then drop (the tabs container needs to be expanded, i.e. icon down, in order to drag stuff onto it):
Now do the same thing to the Phone container, and the editor should something look like:
Note that the tabs are fully functional in the editor, and that the HR tab is not displayed at all in the WYSIWIG. Just like empty containers are hidden, generally empty parts of containers are hidden too.
The accordion is more or less just like tabs except that headers are stacked vertically taking up more vertical real estate, and all content areas are collapsed initially taking up less vertical real estate. This makes the accordion more appropriate for optional fields of lesser importance. Configure the accordion as follows with just two nested field collections with two fields each:
Header Name | Fields |
---|---|
Notes & Attachments |
Notes Attachments |
E-Address |
Email Address Web Page |
HR |
Again, leave the HR content area empty. Once you've configured the accordion, the editor looks like:
Now beauty is in the eye of the beholder, but I still think pretty is a stretch.
Anyway, I think we've achieved the goal of making a messy form more visually appealing and functional. If you disagree, move some stuff around, add some containers, make it your own.
So it's taken me hours to write this document so far. It's probably taken you 30 minutes or so to read it up to this point, depending on a number of factors like attention span, and weather your trying to follow along with a SharePoint site open in another tab, etc. But once you get familiar with the interface, you could configure a form like this from scratch in 2-3 minutes tops. Being able to satisfy a requirement as vague as 'make the form pretty' in a few minutes is pretty nice.
We're pretty much done with the basic structure and layout of the form. Go ahead and go to the new form for your list and it should look like this (assuming you've saved your changes of course):
So what's with this ...Almost crap? OK, I know I'm not fooling anybody, you can all see the next header, I've dropped plenty of hints, and we haven't configured any of the fields specific to the Employee content type. If you go back to the list and open the new Employee form, you'll see the Employee specific fields at the bottom of the form drawn just the way SharePoint would usually draw them. That's because they are on the default form, and in our SPEasyForms configuration we put the default form at the bottom of the page. If you drag the default form to the top of the containers in the editor, save your configuration, and reload the page you'll see these fields are at the top of the form. You may or may not want to leave some fields on the default form. If you don't, read the next section which will tell you how to configure multiple content types.
If you skipped the overview and you've just been following along without being particularly inquisitive and clicking on stuff I haven't told you about yet, you may have noticed that at no point in following this scenario did you see the Employee specific fields anywhere in the editor. That's because when the editor loads it brings up the default content type. But given your recent experience with opening the new Employee form, you should understand some things about how SPEasyForms deals with multiple content types:
Once the content type is changed, fields from the previous content type that don't exist in the new content type are removed from the editor. Any fields specific to the new content type are added to the editor. If they've never been configured before, they are added to the default form container. If you don't see them, you might need to expand this container. Once the data has been fetched, it is cached in the browser session so there is no wait switching back and forth between content types, but not in the browsers page cache, so clearing the page cache will have no effect. If you modify the content type in this or another browser after it has been cached, to see your changes in the editor you need to hit the clear cache button in the ribbon, which will reload the page (save any changes first).
So switch to the Employee content type in the editor now and you should see the Employee specific fields appear in the default form container. If you don't, try expanding the default form container. Now drag a couple of these fields onto the HR tab, and the other two onto the HR content area of the accordion. Save your changes and refresh or reopen the new Employee form, and you should now see the HR tab/content area with the employee specific fields on them. Go back to the new Contact form and you will see the HR tab and content area are still hidden. So your new Employee form should look something like this:
With the following caveats:
You now know everything you need to know about configuring multiple content types in SPEasyForms, we are truly done with modifying the form structure, and thus we are done with containers.
How would you like to be able to make your forms look something like this?
That's about as fancy as you can get using the rich text editor. You can also add ordered or bulled list, images, hyperlinks, and/or horizontal rules.
<div class="ui-widget-header ui-corner-all"> <div class="header">Basic Information</div> </div> <link rel='stylesheet' type='text/css' href='/sites/speasyforms/Style%20Library/Speasyformsassets/HtmlSnippet.css' />
#spEasyFormsContainersPre { border: 1px solid darkgrey; -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; background: #eee; } .speasyforms-container[data-containertype='Tabs'], .speasyforms-container[data-containertype='Accordion'] { margin: 40px auto; } .speasyforms-container[data-containername='2 Columns'] { margin: 30px auto 0 auto; } .speasyforms-container[data-containername='4 Columns'] { margin: 0 auto 30px auto; } .header { font: bold italic 2em "Comic Sans MS"; text-align: center; }
The Stack container is new to 2015.01.01, and really wouldn't have been useful in the previous version because there were no nested containers, but with nested containers it can be useful.
At the top level SPEasyForms is naturally a stack. You pile containers one on top of the other and it transforms the form by drawing one container on top of the other. But containers like Tabs and Accordion draw one tab or page per immediate child. So there's no way to put more than one container on a single tab or accordion page. At least, not without the stack container.
To demonstrate, I'll take the form we've been working with, but I've added one new field to the list called Rating of type Numeric. For now it's still on the default form. Now I'll perform the following actions in the editor:
Note that the form view doesn't really look any different. There may be a little more padding around the columns containers, but they were already stacked on top of each other.
Now drag the Basic Information stack to the top of the tabs container and the Miscellaneous stack to the bottom of the tabs container, and in the properties pane it looks like this:
I now have 5 tabs, with the first and last tab each have multiple container stacks on them. If I save my configuration and go to the new form, it looks like:
and if I click the Miscellaneous tab it looks like:
This is assuming you've gone to the new Employee form, otherwise the HR tab and page would be missing. And that's really all there is to stacks. They just allow you to logically group other containers so you can move them as an autonomous unit and build arbitrary grids of containers at any level.
As you can see, the properties pane and form can both get pretty complex when you start nesting at multiple levels. For this reason, I've limited the maximum nesting level to 5. If you try to move something to a place that would result in more than 5 levels of nesting, the placeholder turns red. If you drop it anyway, it will return to its original position. There isn't any technical reason I couldn't allow deeper nesting, 5 just seemed like a good practical limit. If you find you need more, I'd be happy to tell you how to modify my code to raise the limit, and maybe even increase it myself in future releases.
The Wizard container is kind of a special case. Unlike Tabs or Accordion, I really only see the Wizard container as useful if most, or even all, of the fields are on it. It allows you to paginate a form so users can step through it.
I've used wizards many times in my career for installers or troubleshooting guides, etc. But when it came time to write this section I drew a blank on a good example, so I used a rather whimsical list with a new form that looks like:
And I'm going to configure the Wizard container to have one page for each question, after which the SPEasyForms settings page looks like:
Just like any other container, you can put as many fields or sub-containers on a page as you like. I just didn't have a lot of fields so one per page works. Now when a user opens the new form, they see:
If they hit the next button and they'll see:
If they keep hitting next until they get to the end they'll see:
For the most part that's it; it's just a basic wizard or survey. Keep in mind that the user can submit at any time, they don't have to get to the end in order to submit. If there are validation errors on a page upon submit, the form will switch to the first page with a validation error displaying the error message.
Also note that the Wizard container only modifies new and edit forms. Having to page through the display form just seems a bit pointless and annoying to me.
One other thing you might want to take advantage of is that just like any other container that hides fields, the Wizard container will skip pages if all of the fields on the page have been hidden using conditional visibility rules or are not present in the current content type. This allows you to create branching logic, so if I add the following visibility rules to my SPEasyForms configuration:
The form appears to change from a four page wizard to a three page wizard, with the last question being either 'What is your favorite color?' or 'What is the capital of Assyria?' depending on how you answered the question 'What is your quest?'. I'm getting a bit ahead of myself talking about visibility rules, but that topic is coming up very soon.
So what happens when a required field is on a tab and the user hits submit without providing a value?
Validation for the Accordion feature works in the same manner.
Note: this is NOT a security mechanism. It is appropriate for "business process" visibility requirements. If disclosure of fields to the wrong people would be considered to be any kind of a security breach, no front end solution is appropriate. A clever/technically savvy user can get to fields that are supposed to be hidden from them using the JavaScript debugger or DOM inspector, or in SharePoint 2010 even just viewing source in the browser. Even if I could fix that, and I can't, they could write their own JavaScript, call the web services, and view the raw data.
I get a lot of requirements like "I don't want people in group X to see the phone number field". Or "I only want people in group Y to see the phone number field". Or the address field should be on the edit form but not the new form. Or even I want people to be able to edit the title field if A=B, but it should be read only when A=C, where A is another field in the same form. Conditional visibility in SPEasyForms is intended to satisfy all of these requirements and more.
Here are the step by step instructions to start configuring a field visibility rule for a given field:
For a new rule, the Add/Edit Visibility Dialog comes up looking like this:
There is a lot of stuff here, most of which we're going to ignore for a moment. The only required field on this dialog is the State, which determines what you want done to the field if this rule is executed. Choose Hidden as the State and click the OK button. The Conditional Visibility Dialog now looks like this:
This rules just says hide the field from everyone on all forms with no conditions. As a stand alone rule, this is rarely going to make sense. If you never want it displayed or editable, why did you add the field in the first place? I suppose you could be setting the field through a workflow and using it in a view or something like that. However, once we start looking at multiple rules and precedence, you may find that you are writing rules like this pretty frequently as part of a set of rules for the same field, but we'll get to that in a bit.
Looking back at the Add/Edit Rule Dialog you can see the forms to which the rule applies, and New, Edit, and Display are all checked by default. Click the gear icon next to the rule to edit it, remove the check on the Edit and Display, click OK. Now the rule says hide the field on the new form with no other conditions. This rule is more likely to make sense even as a stand alone rule. It satisfies all of the 'the address field should be on the edit form but not the new form' type requirements, and I've certainly been given real requirements like this before. If you click the OK button on the Visibility Rules Dialog and the Save button on the ribbon, you can go to the new Contact form and the Full Name column is now gone. If you save a Contact and go to the edit form, it's back. That's about it for the simplest of rules.
The next class of requirements that I wanted to satisfy is the 'some people should see it, others should not' type of requirements, which is the most common use case for conditional visibility. To accomplish this, you need to put the people in question in SharePoint groups and then create a rule using those groups, like so:
The applies to control is an entity editor, much like SharePoint's people picker, which mostly works but I know still needs some work too. It allows you to start entering a SharePoint group name, provides auto complete on contains case insensitive, and when you select a group it adds an entity. To remove an entity click the X on the entity. Where it falls short is that if you type some text but don't resolve it to an entity, when you click OK it silently throws away your text instead of raising a validation error, even if you typed the full group name. I may or may not fix that before the first release. Either way I know it is a little weak and will fix it eventually. For now I've warned you about it so caveat emptor.
Back on point, the above rule says hide the field for members and visitors with no other conditions. This will show the field to anybody not in those groups, so it satisfies some of this type of requirement. For more complex cases, you need multiple rules, and blah, blah, blah, we'll get to it soon I promise.
The other thing to note is the author check box in the applies to area. This is there to allow you to apply a rule specifically to the original author of the item (i.e. whoever opened the new form and saved it). It's not that uncommon to get requirements like make this field editable by the author but read only for everybody else, and without this check box there would be no way to generally satisfy this requirement. Of course, once again you'd need multiple blah, blah, blah, because a single rule can only have one state.
The last class of individual conditional requirements I wanted to satisfy is rules like 'make the field hidden if Code is red, read only if Code is green, and editable if Code is blue. This will obviously require multiple rules and we're still not ready for that, but the basic building block for this type of rule is something like:
Which is make the field hidden when Code equals red. Note that all three of the comparison operators built in are case insensitive. I went back and forth on this a little, but mostly I question the usefulness of having a form where red and Red are both options but mean different things, so I think I settled on the most common use case. In addition to Equals, the built in comparison operators include Matches and NotMatches. If the value is literal, then these are equivalent to Contains or NotContains. But Matches and NotMatches also accept and will evaluate JavaScript style regular expressions. If you're not familiar with regular expressions, start binging because this document is not going to attempt to explain them, but a really verbose/obtuse way to achieve the equivalent of what's above would be
"And When Code Matches ^[Rr][Ee][Dd]$"
(unnecessarily verbose in this case because the comparison is already case insensitive, but if you know anything about regular expressions you get the idea). It's also important to understand what you are comparing too. You're comparison is against the text that is displayed when the field is read only (or more accurately, the HTML). It is not against the internal representation of the data as it is stored in SharePoint. So don't try matching a user with something like "2;#Joe McShea", that's not going to work. What's displayed for a user is a link to the userdisp.aspx page with the text of the display name, so that is what you're comparing against. If you are not sure what to look for, make the field read only for everyone, open the edit form for an item that has a value in the field, and look at the source in the DOM inspector or debugger of your browser.
One of the cool things about rules based on the value of another field is that they will be executed immediately as the value of the other field changes on the form. So save the above rule, open the new Contact form, and change the Code to Red and the Full Name field should disappear. Change it back to Green and it reappears. But in the interest of full disclosure I should note that I started off this paragraph with a half truth. This only works for some types of 'other fields' right now. I've tested it on check boxes, radio buttons, drop downs, multi-select choices, and even single and multi-line text fields and it works. But I also know it doesn't work on rich text, enhanced rich text, and date fields, and I haven't even bothered to test some field types. I suspect where it doesn't work it is because Microsoft has their own change listeners on the controls and they are swallowing the event, or something like that, but I haven't looked too hard to prove that at this point. What it comes down to is, I satisfied most of the requirements for this type of functionality that I've encountered in the real world just making this work with choice fields, so I've moved on for now.
The final thing of interest for this type of rule as a stand alone rule is that you can have more than one condition in a rule. Up to 3 right now just to simplify the UI, but the back end supports an unlimited number and I may make the UI more flexible later on. You add conditions by clicking the + icon button, and multiple conditions in a rule are ANDed together, so:
says when Code Equals red AND State/Province matches VA. You can do OR as well, but only with multiple rules, and blah, blah, blah, if I'm sick of saying it I imagine you're sick of hearing it.
So there are basically three fundamental types of conditions as described in the three previous sections, Applies To, Forms, and And When. You can specify any combination of these conditions in a single rule. When more than one of these types of conditions is specified, they are ANDed together. And I've already said it in the previous sections, but it bears repeating succinctly and in one place to avoid confusion; each of these types of conditions can contain multiple comparisons, and when they do, weather it is an AND or OR is handled differently for each, so to reiterate:
Consider the following rules for the Full Name field:
Rules are evaluated as follows:
So when the above rules are evaluated, the first rule, which applies to everyone with no other conditions is always true, the field is always hidden, and the other rules are never evaluated. To get the intended results, you need to reorder these rules like so (which you can do via drag and drop):
That's better, but understand that these rules must be in this order exactly to be interpreted consistently. You may think that you can reverse the first two rules and the results are the same, but these rules are not mutually exclusive. Somebody can be both the author and a member, or a member and a owner, and if you reversed the order of the first two fields these users would always see the field as read only, which is clearly not the desired result but given the precedence of operations it is what you told SPEasyForms you wanted.
The other thing to note with this set of rules is the state of Editable. This really just means don't do anything to the field (so for instance on the view form it will still be read only). Why would we need such a rule? I can easily accomplish nothing without any rules whatsoever; heck, without any code whatsoever too. In this case it is so I don't fall through to the 'hide the field from everyone' rule. This is the reason why 'hide the field from everyone' may make sense as part of a set of rules even though it usually does not make sense as a stand alone rule. It's kind of like firewall rules if you are familiar with the concept. You need to put specific rules before general rules, so in order to satisfy requirements like 'owners can edit, but for everyone else it should be hidden,' you need some way to specify a rule that permits owners to edit, even though allowing edit is the default if there are no rules whatsoever.
For our scenario, we have the following requirements for the given fields:
Lets take the first set of requirements and start with the Job Title field. First off, given what we now know about precedence of operations, these requirements are not in the order in which they should be implemented, but customers do not really care about such technical details. The configuration for Job Title should look something like:
In this case something like is accurate, because since the last three rules are mutually exclusive it does not matter what order they are in, the code will never be both red and green. If code were a multiple choice select field it would be a different story. But the manager rule has to be at the top, or one of the other three rules will always get executed before it is reached. Note also, that the rule that says 'make Job Title Editable if Code equals blue' is completely unnecessary. If removed, when Code is blue and the current user is not a manager, it will drop through all rules without executing any of them, and the result is the same. I think it is a little cleaner with the unneeded rule, but you can decide for yourself. If you configure the above rules for all four of the fields named above, the Conditional Visibility View will look like:
This view is the only place where you can go and see all of the visibility rules for the form (for a given content type, rules that are for fields that do not exist in the current content type are hidden). The rules are sorted by column display name. There are no buttons, and you cannot drag and drop these rules from here, but you can double click on a rule to bring up the Conditional Visibility Dialog for the given field.
Once you have saved these rules you can check out how they affect the form, but before you do, make sure you know if you are in the Manager group or not, or you may once again be utterly unimpressed with the lack of anything new happening in the form (I've made this mistake before a few times, generally ending in a humbling debugging exercise). By the way, if you add or remove yourself from the Manager group, you should just have to refresh the form to see the difference. The current user's group membership is not cached in any way across page loads, so the effects should be immediate.
Lets move on to the second set of requirements, starting with the field EmployeeId. The configuration for this field should look like:
Note that I didn't say something like this time, the order of these rules is entirely significant. The last rule obviously must be last because it always executes. But you also cannot reverse the order of the first two rules, because if you did then somebody in both the Manager and HR groups would see the field read only while somebody in just the HR group would see it editable, which I doubt is what you want. Go ahead and configure the other three fields like this and the Configuration Visibility View should now look like this:
Save the configuration, go to the new Employee form, and check out the results. You should now know pretty much everything you need to know about conditional visibility rules. Try adding some of your own. Refresh the form and check out the result.
Note that if you use conditional visibility to hide a field or make it read only, and the field has validation errors, the user will be unable to submit the form. The OOB validation message is hidden, because the entire cell is hidden. If the field is on a tab or accordion content area, the header will be highlighted in red and the first one with validation errors will be automatically selected, but again the OOB validation message is hidden. Even if the validation message was displayed, the user would not be able to fix the problem because there are no input controls in which the required field can be entered. So as a general rule of thumb:
Field Control Adapters are basically intended to be a replacement for custom fields in SharePoint, or at least to provide custom field like behavior in SharePoint forms using only OOB field types. There are numerous shortcomings of custom field types. For starters they are a farm solution, which is tantamount to being downright evil by modern Microsoft doctrine. But they also suffer some reduced functionality, for instance they cannot be edited in datasheet view. This has always struck me as an unnecessary limitation; why not let people edit it just like an SPFieldText if it is based on SPFieldText, but Microsoft chose to punt and it is what it is.
This is also the area where I see SPEasyForms expanding the most in future releases. The possibilities are nearly endless. Have you ever gotten requirements like:
These may be obscure cases, but if you can imagine it, you can probably find someone out there who will say 'yeah, give me one of those.'
But for now I've tried to implement just a small number of these that I consider to be low hanging fruit, meaning I've been asked for these often or I've seen people asking how to implement these in a SharePoint list often. The adapters I've implemented so far are:
Before I get into the details of any of them, I want to document the steps for getting to a control adapter dialog for a given field right now so I don't have to repeat it in the implementation specific sections below:
One thing of note is that if there are multiple adapter implementations available for a given field type, you will only ever be able to configure a specific field to use one adapter or the other. To change the adapter for a given field, you must first remove the adapter and then add one again choosing a different implementation. You can delete an adapter by clicking the X button next to it in the Field Adapters View. The reason you will only ever be able to put one adapter on a specific field is that adapters manipulate the DOM of the OOB controls for a field, and would almost certainly step on each other. Not buying it? Try to imagine merging the functionality of the dog's tail voter and the thermometer slider described at the beginning of this section in any kind of generic and meaningful way. Think about it?
In order for Autocomplete to be configured, all you need to know is the name of another list in the same site and the display name of the field in that list that you want used for type ahead functionality. For our scenario, my requirement is going to be:
I've already created the JobTitles list and populated it, and it looks like this:
So when I click on the shuffle icon button next to Job Title I am presented with the following dialog:
Of course yours is not all filled in yet like mine is, I just didn't want to do before and after screen shots. The only configuration is that you need to select the title of the lookup list and the title of the lookup column. The screen may freeze for a few seconds when you first launch this dialog or when you choose a lookup list. The first case is because I need to get a list of list titles for the site from a web service, and the second is because I need to get list meta data from a web service. In both cases I cache the result so subsequent usage of the same data in the same browser session will be faster.
Anyway, once I've configured this and saved my configuration, I can go back to the form and I should have Autocomplete functionality on the Job Title field:
And that's all you need to know about Autocomplete'sort of. You didn't think there wouldn't be another caveat, did you? If you look back at the screen shot of the JobTitles list, you can see that there is a count in the view, and the view currently has 2499 items in it. If the view has more than the list view threshold for SharePoint (usually 5000 items) you may run into some pretty insurmountable performance issues, especially in Internet Explorer. In fact, sometimes the browser hangs with 4000 items. It may be worse if you are bandwidth or latency challenged or your SharePoint farm is not very speedy.
This is in part because of the current implementation of the Autocomplete adapter, which fetches the entire list into a big array on form load (well, just the one field, but still it can be a non-trivial amount of data). I could theoretically make some performance gains by not fetching the list until the user typed a few characters and trimming the results on the server side by sending a CAML query. On the other hand, that would mean more web service calls if the user changed the first few characters, which could perform even worse. I may look at a solution for larger lists in the future, but for now I think I've satisfied the low hanging fruit of Autocomplete.
If you want to remove an Autocomplete adapter from a field, open the dialog, blank out the lookup list control, and hit Ok.
Do a search on Bing for 'sharepoint cascading lookup' or 'sharepoint cascading dropdown' and you'll see a lot of questions and even a lot of solutions. I chose not to write my own since there is a perfectly good implementation in SPServices, which I'm already using for calling all of the SharePoint web services, so if you have ever used cascading lookups using SPServices you already know how to setup the lookup lists. If not, I'll show you in a moment, but first lets talk about the requirements for our scenario:
Pretty standard stuff in terms of cascading lookup requirements. The lookup lists look like:
The concept of cascading lookups depends heavily on a relationship list, which describes the relationship between a parent column and a child column. In the case of the first requirement above:
There is a parent field and a child field in both the relationship list and the current form, and that is what you need to pair up to configure cascading drop downs. The relationship list is a lookup list for the child column in the current form. It also has a lookup to the list that the parent column in the current form looks up against. When I say the current form, I'm talking about the form you are currently configuring in SPEasyForms.
Note that in my case I have also modified the fields in my lookup list so the display names of the parent column and child column match the display names of the lookup fields in the current list. This is not strictly speaking necessary, but it does make the configuration of cascading drop downs much easier as I'll demonstrate in a moment. I've also grouped the views above by the parent lookup field, which isn't necessary at all to make this work, but doesn't it look nice?
To configure cascading drop downs, click the shuffle icon button next to the child lookup field (the one that will be trimmed) in the properties pane (for requirement 1 that's the SalesDivision field). That brings up the Cascading Lookup Dialog:
It may take a couple of seconds to launch if I haven't already cached the list of list titles. The only things filled out on load are the name of this list and the name of the child column. In order to configure the rest, I first need to select the name of the relationship list, which in this case is SalesDivision, after which the dialog looks like this:
And voila, we're done. I was able to guess the rest of the configuration because there is only one lookup in the relationship list and the display names in the relationship list match the display names in the child form. If that were not true, I would have had to manually marry up the relationship list fields with the current form fields. So follow the same steps to configure the SalesState cascading look up, and the form fields now look like:
Note that there are no options to select for SalesDivision or SalesState. Select a SalesRegion, and SalesDivision gets appropriate options:
And if you configured SalesState correctly, select a SalesDivision and SalesState should have appropriate options.
If you want to remove a Cascading Look Up adapter from a field, open the dialog, blank out the relationship list control, and hit Ok.
And that is all you need to know about cascading look ups. No really, no caveat.
The lookup detail adapter was originally delivered as an AddOn to 2014.01, and provides the following functionality:
Note that since the data from the lookup list is duplicated in the current list, this adapter is only appropriate for situations where what you want is a snapshot of what the data was at the time when the form is filled out. The data is not updated when the data in the lookup list changes; it is only updated when the selected value of the lookup field in the list item changes.
An example of how this might be used is a poor man's shopping cart. Say you had a list of inventory items that looks like:
And you have a list named Cart whose new form looks like:
I've already done some SPEasyForms configuration on this list. I've created a simple master/detail type form, with a lookup on the left (highlighted in red) and 3 detail fields on the right. What I want is to have the 3 fields on the right get populated from the lookup list when an item is selected on the left, and I also want these 3 fields to be read only. The Select an Item field is a lookup to the Inventory list, and the goal is that the Item, Description, and Price fields will be mapped to the Item, Description, and Price fields in the Inventory list using the Lookup Detail Adapter.
The types of these fields are the same in both lists; Single-Line Text, Multi-Line Text, and Currency. This is not strictly required in any way, but for best results the source and destination fields should be the same type. This means not only the same SPFieldType, but also that the fields should be configured the same, in other words the Description field is configured for enhanced rich text in both lists and the Price field is configured for US currency format in each list. If your fields are not the same type and/or are not configured the same in both lists, your mileage may vary. And I will be unsympathetic to issues raised, because type mismatches are allowed but not supported, or at least not guaranteed to work the way you might expect. There are just too many combinations to try to address, for instance what is the expected result of mapping a currency field to a user field? I'd expect it not to work very well, which it won't, so it's working as designed and just don't do that please.
So my initial SPEasyForms configuration looks like this:
With the following visibility rule:
Now we're ready to configure our Lookup Detail Adapters, so follow these steps to configure the Item field as a lookup detail:
Now if you go to the new form and select 'Secrets of the Javascript Ninja' on the left, it will fill in the inputs to the right like so:
But we're still missing something, the fields on the right were supposed to be read only. I was originally going to put a checkbox on the adapter dialog for if you wanted the field read only, and make it read only in the adapter transformation. But that turned out to be kind of buggy and conflicted with the conditional visibility rules, which execute at an earlier stage of the transformation, so I ripped that out. As a result, if you want it read only, you'll need to configure conditional visibility rules separately, like so:
Now if you go to the new form and select 'Secrets of the Javascript Ninja' on the left, it will fill in the inputs to the right and they'll be read only like so:
Note that since the Item field is redundant, I've hidden it completely. The reason for the redundant field is because I want them to be able to pick a title from a drop down, but the title field in a SharePoint list item doesn't work that way (although I could create another adapter that makes it work that way).
The default to current use adapter is as simple as an adapter can be, so I'm not going to write much about it. It can only be applied to user fields (either single or multiple user fields). When you click the icon to add an adapter, you get this dialog prompt:
Simply hit the Add button and you're done. When the new form is opened, if the user field is empty, it will be pre-populated with the current user. It does nothing on the edit or display forms.
The Star Rating adapter can be applied to fields of field type Numeric, and provides an interface for the field that is a graphic of 5 grey or gold stars. In the new or edit form, users can choose the rating by clicking on the appropriate star. It is as simple to configure as the default to current user adapter, just click the wrench icon next to a numeric field and you get this dialog prompt:
Simply click the Add button and we're done. To demonstrate, I'm going to go back to the form we've been configuring for our scenario where if you'll recall I've already added a Numeric field called Rating. I'm going to rename this field Technical Rating and add two more Numeric fields called Leadership Rating and Overall Rating. And I'm going to drag all three fields to the Rating field collection on the Miscellaneous tab, after which my editor should look like:
If I save this and go to the new or edit form, the Miscellaneous tab now looks like:
And I can click on the stars to change my rating. I can even click a little to the left of the first star to change the rating to 0 stars (there's nothing I hate worse than a review that says I would have given 0 stars if I could have).
Just as there is a view for seeing all visibility rules, there is also a Field Adapters View in the editor for seeing all configured adapters by field display name (for the current content type). After configuring the adapters described in the previous sections, this view should look like this:
The last column in this table shows adapter specific configuration in the raw, because the editor does not know anything about this configuration information other than that it is in the configuration. You can delete an adapter by clicking the X button to the right of it and edit an adapter by double clicking anywhere on it's row.
Note that the foreign lists are stored by GUID and Title. The GUID is used to find the list, but if there is no list with the given id the Title is used instead. This means the configuration should fix itself on import as long as there is a list with the same Title in the site you are importing to, and it has the same fields.
None of the adapters included in this release release has any validation issues, since they do not hide the field/controls, they just augment the functionality of the field. It is certainly quite possible that a field adapter could hide validation errors from the user, making it difficult or impossible for the user to submit the form, but validation works the same on Autocomplete fields and Cascading Look Up fields as it does on OOB text fields and look up fields.
Well, that's it. I think I've now described all of the functionality that will be included in the 2015.01.01 release. Hopefully somebody else finds it useful.
The nice thing about the requirements in the scenario used in this document is that they all mapped nicely to what SPEasyForms already does. You're mileage may vary. But if you do have requirements that cannot be met by SPEasyForms, let me know. I'm always looking for ideas for the next version.
You can initialize values in forms for most SPFieldTypes by passing request parameters in the URL, but because of the number of different SPFieldTypes, using it is not entirely intuitive. In general:
So, if you go to a form with a URL like:
<formURL>?spef_Title=My New Title& spef_Description=My New Description
SPEasyForms will look for a field with the internal name of Title and set it to 'My New Title' and a field with the internal name of Description and set it to the value 'My New Description'. So you can pretty much stop reading now, right? It's pretty self explanatory? But how do you set a people picker field? or a boolean? or a date/time? A lot of decisions had to be made during the coding about how to set different field types. You could guess about how those decisions were made, or you could read the table below:
SPFieldType |
Example |
Description |
SPFieldText SPFieldNumber SPFieldCurrency |
spef_Title= text |
Nothing special here, this is the simple case. |
SPFieldNote SPFieldMultiLine | spef_Description= text |
Newlines will have to be escaped, and this only works on fields designated as plain text. Enhanced Rich Text does not work and Rich Text wasn't actually tested. |
SPFieldChoice (Dropdown) | spef_Choice=A | A should equal the text of an option in the drop down. If not, A will be inserted into the fill-in input box if there is one. |
SPFieldChoice
(Radio) |
spef_Choice=A | A should equal the text of label for a radio button. If not, A will be inserted into the fill-in input box if there is one. |
SPFieldChoice (Checkboxes) | spef_Choice=A;B;C | A, B, and C should each equal the text in a label for one of the checkboxes. If not, they will be appended to the fill-in input box if there is one, with multiple values separated by a semi-colon. |
SPFieldDate | spef_DateAndTime= 1/2/2015 4:25 PM |
The date passed in must be able to be parsed by the JavaScript Date object. This can unfortunately be somewhat browser specific, for instance I originally left out the space before PM in the example, which worked fine in IE but not in FireFox. The time may be omitted and will be ignored if the field is date only. |
SPFieldBoolean | spef_YesNo=NO | You can pass in either 0, no, or false (case insensitive) to uncheck the box. Any other value will check the box. |
SPFieldURl | spef_HyperLink= http://speasyforms.com| SPEasyForms |
Pass in just a URL and it will be used for the URL and the description. To pass a separate description, pass the URL, followed by a pipe, followed by the description. |
SPFieldUser | spef_User= joe@speasyforms.com |
Pass in any value that the people picker can resolve (user name, email, SIP address, even display name if it is unique). If the field accepts groups, you can pass in anything that can be uniquely resolved to a group |
SPFieldUserMulti | spef_Users= joe@speasyforms.com; SPEasyForms Visitors |
Same as above except multiple values are separated by a semi-colon. |
SPFieldLookup | spef_Lookup=3 | Generally, you should always pass in the ID for a lookup. You can pass the text instead, but if it is not unique the first match as it appear in the dropdown will be selected. |
SPFieldLookupMulti | spef_LookupMulti=3;7 | Same as above except multiple values are separated by a semi-colon. |
Note that if SPEasyForms is installed and activated on a site collection, you can initialize fields using request parameters in any list even if the list is not configured to use SPEasyForms.
One of the weaknesses in the original implementation of conditional expressions in visibility rules was that you could only compare a field with a literal expression. I was asked by someone how you could write an expression to see if a user field contained the current user, and at the time the answer was you can't. But this would obviously be pretty useful, so I went ahead and added it. You can now create a conditional expression like:
Where 'Manager' Matches '[CurrentUser]'
and if Manager is a people picker field, the visibility rules engine will substitute a pattern for [CurrentUser] that will make the expression work. While I was at it, I added several other variable expressions that I thought would be handy. The table below shows the complete list of variable expressions you can use:
Expression |
Interpretation |
[CurrentUser] | Gets replaced with a regular expression suitable for matching against a people picker field. The actual expression 'userdisp.aspx\\?ID=' + currentUserId + '[$&]', which matches the link to a user in a people picker. |
[CurrentUserId] | Gets replaced with the site collection integer id of the current user. |
[CurrentUserLogin] | Gets replaced with the current user's login name. The format of the name may vary depending on the authentication method and SharePoint version. For instance this may be a domain name, or it may be a claims based name. Whatever appears in the user name field on userdisp.aspx is what will be used here. |
[CurrentUserEmail] | Gets replaced with the work email address of the current user. |
[Today] | Gets replaced with todays date. |
[Today+2] | Gets replaced with todays date plus 2 days. You can add or subtract any number of days by added [+-]X, where X is an integer. |
[Now] | Gets replaced with the current date/time. |
[Now-60] | Gets replaced with the current date/time minus 60 minutes. You can add or subtract any number of minutes by added [+-]X, where X is an integer. |
Its not an exhaustive list; these are just the variable expressions I thought would be useful on the spur of the moment. If there are other variable expressions you think would be useful, let me know on the CodePlex discussion board and I'll consider adding them.