Sitecore Name Value List field with special characters

The question came up and wrote it to Sitecore StackExchange. Thank you @jammykam for your answer.

The default Sitecore Name Value List field has an annoying issue. It does not allow to use special characters like ‘-‘ for the key. I just digged into the Sitecore.Kernel library and I found a regular expression validation which is hardcoded.

Let’s overwrite this class make it more flexible. The main issue with the implementation that they don’t encode/decode the URI.

With the following class is the implementation of the new NameValueList field which allows you special characters:

To use this field you should add it to Sitecore to the following place in core database.


You also need to add the following to the Sitecore config to make this field used by the Sitecore field item.

5 thoughts on “Sitecore Name Value List field with special characters

  1. It’s been a while, but this is still relevant.Thank you.

    One things to note though is that you need to provide the assembly and class when you add the item to the core DB. See for an example. The assembly name is just that (unlike other places where you need to put the namespace with the assembly name). And the class name is the fully qualified (with the namespace).


    1. Also, NameValue will replace your special character when the onload() method is called due to the base call (which you’ve removed completely). I didn’t want to remove that call because it does a lot of stuff upstream from Input. The way I got this to work for me was to simply make my new class detached from NameValue (so it just extends Input) and make the necessary tweaks.


      1. It’s been a while, so I don’t remember completely why I removed the base call for OnLoad. Usually better, to keep it and call the base method. I would have to post the Sitecore version as it is quite hacky way to solve the problem and it can differ on different versions.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s