Custom field validation using JSLink is an extremely powerful beast. In this post I’m going to make an effort to demystify the different levels of validation you can put into your custom template and how to put it together. Everything I’m about to cover has been covered before in different ways and in different combinations. My hope is that this will help separate out what’s needed and what’s not depending on your scenario… so to that end I’ll cover three scenarios. Basic, which will be OOB validation that is custom applied. By that I mean you want to optionally make a field required just like SharePoint does, but you want to control when it’s required. Custom, which will be a custom validation function that renders its error message just like OOB validation error messages are rendered. And finally, advanced, where not only do you want to write a custom validation but you want to control how the error state is communicated to the user.
[Continue Reading]
JSLink Validation – from Basic to Advanced
JSLink Custom User Field Schema
I had the requirement of setting the default value of a person field to the current user. After looking around in the great wide internet I found a very helpful article by Glenn Reian article by Glenn Reian which got me started.
Where I ran into a problem was that my user field had customized settings that weren’t being pulled through into the custom implementation of my people picker. As it turns out the issue was with the schema that is passed to the SPClientPeoplePicker_InitStandaloneControlWrapper function. In Glenn’s example (and every other example I found out there) this schema is hard coded, which is perfectly acceptable in most cases. However, I needed some values to be slightly different to adhere to my column settings.
[Continue Reading]
SharePoint 2013 JSLink - All Fields Rendered
While creating a custom Client Template using JSLink, I came up against the issue of knowing when all the fields were rendered on the form. To explain where the issue arises let me first take just a moment to explain when building a custom template for this type of form, where you want to manipulate the fields, you have available to you both a Pre and Post Render function. What that does is fire the function attached to it either pre or post each custom field rendering being executed.
[Continue Reading]