Monthly Archive: April 2017

EPiServer Forms: Adding custom client side validation to form field (Luhn algorithm)

When you’re developing custom EPiServer Forms field blocks you sometimes need to add your own custom validation as well. In this article you’ll see an example of how to add client side validation for the Luhn algorithm in a custom textfield block. This article assumes that you already have server side validation on your EPiServer Forms field; covered in article EPiServer Forms: Adding custom server …

EPiServer Forms: Adding custom server side validation to form fields (Luhn algorithm)

When you’re adding custom EPiServer Forms field blocks to your solution, you occasionally have the need for adding custom validation as well. Here is a sample of how to add a custom server side validation to your textfield block; you will probably also need client side validation for this, please see the article EPiServer Forms: Adding custom client side validation to form field (Luhn algorithm). …

EPiServer Forms: Forcing a field block to use a certain validator

There may arise situations where your custom EPiServer Forms field blocks make no sense without your custom validation code being applied as the website visitor submits the form. In these cases it may be useful to help the web editor by preventing the need to tick the correct validation checkbox in the form element block. Creds to my collegue Christer Bermar for his work on …

EPiServer Forms: Moving your EPiSever Forms views to another location

By default, EPiServer Form views goes in the directory /Views/Shared/ElementBlocks/, however if you’d like them placed elsewhere, this is easily done by adding a simple service configuration and extending EPiServer’s CustomViewLocationBase making an addition to it’s Paths array; see below. MyCustomViewLocationBase.cs Above code will allow you to keep views in a Forms directory in the Views/Shared folder.

NullReferenceException in EPiServer EPiResourcesController causing edit mode load to fail

In one of my current projects EPiServer‘s edit mode suddenly stopped working. Only the top bar loaded, while the rest failed due to a JavaScript error (see image below). NetworkError: 500 Internal Server Error caused by GetResourcesDictionary throwing NullReferenceException To investigate, we tried surfing to the failing JavaScript resource (http://{host}/EPiServer/Shell/10.7.1.0/ClientResources/EPi/shell/ui/nls/en-us/contenttypes.js) only to discover that the 500 Internal Server Error was caused by a NullReferenceException. Stack …