Extending #Episerver.forms with URL QueryString/post Value Element

How to extend Episerver Forms with a hidden QueryString/HttpPost Value Element.

Published 22nd of May 2017
For Episerver Version 10 and Forms > 4.4

Security warning! Be aware of how you use url parameters. This may be a security risk. Use at own risk or not at all.

Had a case where I needed to save a PageId into a form, similar to an order functionality.

You need an Element model:

And the view (which is a copy of built in PredefinedHiddenElementBlock.ascx)

Save your view under views/shared/elementblocks/

When using the element, just fill in the “Predefined value” with the key used by Querystring or form post.

It pops up in the form elements pane:

And in onpage edit:

In email placeholder you’ll find #OrderId#:

Use it wizely with httpGet or HttpPost

More reading

SEO terms:

  • Hidden post value in element of Episerver Form
  • How to extend episerver forms with querystring value

Get page property from submitting page in #Episerver.Forms

How to read a querystring value from the referrer/hosted form page. Also how to read a page property from the submitting page.

Published 16th May 2017
For Episerver Version 10 and Forms > 4.4

By implementing IPlaceHolderProvider in the Episerver.Form.UI  Namespace > 4.4 you can use it to add your own implementation of the Placeholder tags in email, eg #yourelement#

You’ll need to add an ExtraPlaceHolder called eg #SomePageProperty# and then implement it under ProcessPlaceHolders.

Important to remember! All placeholders in ProcessPlaceHolders will be triggered on every submit, even if it is not used in that form.

In the submissionData object, you have a SYSTEMCOLUMN_HostedPage item, where the id of the page submitting is saved, this is what we’ll use.

In some scenarios you may want to read the referrer page querystring, this may be used with HttpUtility.ParseQueryString(requestBase.UrlReferrer.Query)[“key”]

!Security warning! Be aware of how you use url parameters. This may be a security risk. Use wisely or not at all.

In my next upcoming blog post I will show how you can save http posted values into hidden formelements, but also querystring values.

Gist: https://gist.github.com/LucGosso/08ebb442e42cbb7fe239afe63ea95df5

More reading:

SEO terms

  • Extending Episerver forms
  • Customize email

Override CSS in #Episerver editor mode

2 min reading how you can customize and override the CSS in Episerver UI admin with help of module system.

Published 19 April 2017
For Episerver Version 9 and later

In Quan Mai book, Pro Episerver Commerce, which I highly recommend for good understanding of Episerver Commerce platform, he mention under chapter 3, page 55, that you can override the CSS to put a height on the image, since there is no default height on images in Catalogue UI.

This is what i need to inject

In my case the proportion of the thumbnails wasn’t default, so I needed to override, but how?

Overriding using module system

Episerver has a great extensionality with its module system. In this case, just add the right folder structure, for example:

sln-root\modules\_protected\CustomCSS\1.0.0\ClientResources\styles\custom.css

Create a module.config

The module.config should be in the root of your plugin-folder, eg sln-root\modules\_protected\CustomCSS\module.config

Dependencies
You need to use the <moduledependencies> to configure when and where it should run you CSS/Script

  • Shell works in dashboard onlinecenter, CMS and Commerce
  • CMS is standard
  • Commerce is loading after CMS
  • Forms and Episerver.Forms.Samples are loading after Commerce

If you have more modules attached to your solution and if you need to have yours latest, check the loadings of css, and try to figure out what the name of the Module loading it is. Check in their module.config.

 

Remember to IISRESET between changes

And yes, you may override scripts too.

Source

SEO terms

  • Styling admin episerver
  • Custom script injection
  • How to make an Addon for Episerver

No More Broken Pics – Provider #AddOn for #EPiServer Developers

Ever restored the Production database to your developer environment and got a website with broken images? This lightweight AddOn keeps your local environment blob directory up to date.

Published 14th March 2017
For Episerver Version 9 and 10

This AddOn provider copies (on page load) the file blobs from production to your local environment, or to your staging/test environment.

For whom?

This AddOn is heaven for developers, get rid of copying the production blobs to your local or test installations.

How it works

When the EPiServer CMS page is binding the model to the page, the Provider GetBlob(URI id) is called for every Blob used on the loaded page. The “Download If Missing File Blob Provider” check if file exists on the local blob directory, if not it requests the file on the Production server and downloads the file with the friendly URL.

The DownloadIfMissingFileBlobProvider is using a web request to the production server since the local database is locked during request(because of possible risk of eternal loop).

The Provider works for the assetsystem in Episerver 9 and 10. It works in parallell with ImageVault but does not operate images in ImageVault. This provider is overriding and extending the default FileBlobProvider from Episerver.

Installation

Available on nuget.episerver.com in VS Package Manager Console ‘install-package Gosso.EPiServerAddOn.DownloadIfMissingFileBlobProvider’. It is dependent to EPiServer Core.

The DLL is installed in the modulesbin-directory. (you may need to add to source-control manually)

More config options: ProjectSite on github

SEO terms
  • Update assets files automatically
  • Download assets system automation
  • Episerver fileprovider addon
  • No more broken images