Limiting number of characters for sitecore single line text field while editing in Experiance editor

846 views Asked by At

Requirement:

  1. Limit the number of characters sitecore single line text field
  2. While editing(not while saving) in experience editor should not allow more than the limit mentioned.
  3. Field should be shown with sub line text (title text should show the details about the limitation)

Example: If the sitecore single line text field is limited to 30 characters, While editing in the experience editor should not allow more than 30 characters and will also sub line (this field will not allow more than 30 characters)

Please provide preferred approach to fulfill this

1

There are 1 answers

0
Ayman Barhoum On

I think you should create Sitecore custom field with javascript to achieve that,there are some blog posts talking about that:

https://www.sitecore.net/company/blog/474/creating-a-custom-sitecore-field-4246

https://www.geekhive.com/buzz/post/2014/05/how-to-create-a-custom-field-in-sitecore/

I have done that before with "Sitecore Tags Field", which is custom field and i am using javascript to get list of available tags, i am sure you don't need that but you can see how i am using javascript with that code, you can check my blog post here:

https://abarhoum.wordpress.com/2017/07/06/sitecore-tag-field-tags-and-autocomplete/

i have uploded the code on github as well:

https://github.com/abarhoum/TagControl