Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Episerver forms - form element validation using data from other form fields



I'd like to create a custom form element with validation, so that validation checks other values from the same form.

Is it possible to read data from other fields during element validation? If so, how can I access the data?

Thanks in advance!

Jul 27, 2017 12:38


Yes, you can read other fields data during element validation. Example:

var submitData = HttpContext.Current.Request.HttpMethod == "POST" ? HttpContext.Current.Request.Form : HttpContext.Current.Request.QueryString;

then you can get a specific element value by using: submitData["__field_123"]. The __field_123 is element name, you can get element name from element content link via extension method: 

public static string GetElementName(this ContentReference elementLink)
    return string.Format("{0}{1}", Constants.ElementIdPrefix, elementLink);


Jul 28, 2017 5:06

Thanks a lot, I got it working.


Jul 28, 2017 8:25

Add my 2cents, the (internal) extension has already existed in 

namespace EPiServer.Forms.Helpers.Internal

static class FormsExtensions

public static string GetElementName(this ContentReference elementLink)

Aug 03, 2017 5:20
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.