13
votes
Accepted
How do I enforce Alt tags on all images in Sitecore
You are able to set the required validation item rule item to FATAL ERROR in Sitecore. This is the highest level of validation. This setting prevent the user to save the item with validation error.
10
votes
Accepted
Stop user from saving and publishing when a field is Empty
1) Publishing
To stop publishing when field is empty, there is no OOTB functionality. One option how you can achieve it with minimal effort is to put item (template) under workflow and use below ...
10
votes
Accepted
Remove Alt Required validation from image
Go to /sitecore/system/Settings/Validation Rules/Field Types/Image item and remove the Image Has Alt Text from the Validation Rules section where you don't want to run this validator. What you removed ...
9
votes
Accepted
Validator bar not appearing for general link field
The question update is your answer. That's standard behaviour of Sitecore. You should also see red squares on the right top.
There you can see all invalid fields as squares. It is not really visible ...
8
votes
How to prevent publish item using validation rule?
Yes, it is possible to do this without customization.
Sitecore has the special validation rule that is named "Required", which checks fields that contain the value.
You can find it in Sitecore/...
7
votes
How do i validate an image for byte-size in Content Editor?
The setting
Well there isn't really a built in validator for this; although you could build one.
But you can - generally - restrict the size of media in your solution. It is controlled via this ...
7
votes
Accepted
7
votes
Special Characters and Spaces in Display Name
Following up on Mark's answer, if you wanted to do just use a regex you could use the following steps:
Go to /sitecore/system/Settings/Validation Rules/Field Rules/
Create a folder called Custom
...
7
votes
Accepted
Make one of two sitecore content fields required?
I would recommend implementing a custom Item validation rule.
Note: This is different from a field validation, in that it validates the entire item instead of a single field.
1. Create custom ...
7
votes
'IServiceProvider' does not contain a definition for 'GetService'
Add "using Microsoft.Extensions.DependencyInjection" to your usings should solve it. I had the same problem and VS didn't added it automatically.
6
votes
Accepted
Sitecore Field Validator Change to Custom Message
OOTB, you cannot change this message because this is present in the Sitecore Kernel dll. Please see screenshot below:
In order to change this message, you will need to override the validators ...
6
votes
Item validator access already stored data instead of newly inputed data
So one thing to note - CriticalError - the user is warned before saving, but the data is still saved. FatalError will stop the item from being saved if validation fails.
But...
What you are trying ...
6
votes
Special Characters and Spaces in Display Name
Display Name is a field. As such, you can enforce its value using normal Sitecore validation and workflow tools.
I am by no means a specialist in writing RegEx expressions, but I'm pretty sure you ...
6
votes
How to implement character limit validation on Single-Line Text and Multi-Line Text fields?
You need just to assign a validation rule to your fields
The Sitecore field validators is a set of user-input validators that can be applied to either an item, a specific field type or a specific ...
6
votes
Accepted
Standard Required field validation reporting field is empty after upgrade to Sitecore 9.0 Update-2
Sitecore Support has determined that this is a bug, public reference number 221523.
While previously it was necessary to contact Sitecore Support if you ran into this issue, Sitecore's Knowledge Base ...
5
votes
Accepted
Remove 'Is valid XHtml' validation rule for Rich Text field
You can remove the rule validation on the Global Rules item /sitecore/system/Settings/Validation Rules/Global Rules
You'll want to remove the rule from the Validate Button, and Validate Button fields ...
4
votes
Validation Errors Not Showing Up in Experience Editor
There may be different reasons for this behavior.
Suppressed validation rules
Open the Content Editor.
In the ribbon tab "View", make sure that the "Standard fields" checkbox is checked.
Open the ...
4
votes
Accepted
Sitecore validation rule at field level in multi-list value selection range
You can pretty much reuse the first regex, just instead of saying that you need 0-5 guids, you should say that you need 0 or more groups of 2 guids:
^({[^}]+}[|]{[^}]+}[|]?)*$
So in fact you use ...
4
votes
Field level Validation Rule => "OnSave"?
you missed to add Parameters on your validator
Parameters are applied using a QueryString-like list like this:
[parameter]=[value]&[parameter]=[value]
The “Result” paremeter determines the ...
4
votes
Accepted
'IServiceProvider' does not contain a definition for 'GetService'
You need to add a reference Microsoft.Extensions.DependencyInjection.Abstractions.dll to your project.
It's not enough to have Microsoft.Extensions.DependencyInjection.dll referenced only.
4
votes
Accepted
How to prevent an item from being moved to another folder accidentally?
There is nothing like that out of the box in Sitecore. But you can easily create such a functionality on your own:
Create a new template with one field only - checkbox "Cannot be moved"
Add your ...
4
votes
Accepted
Dynamic DataSource for Droplist in Content Editor
It is possible via both a custom field implementation or field validation. Below is the code for both ways.
Solution 1 - A Custom Validation
You should implement a class which will extend the ...
4
votes
Dynamic DataSource for Droplist in Content Editor
You can specify custom logic to resolve the source of the field using a code: declaration and setting it to your custom Class.
Include a reference to Sitecore.Buckets.dll and create a class which ...
3
votes
Field level Validation Rule => "OnSave"?
As well as using a rules engine based validator, there are also validation fields on the Field template that you can use:
The Validation field takes a regex and the ValidationText field can be used ...
3
votes
Accepted
Disable validation in WFFM forms, if required fields are in hidden mode
Currently in WFFM, this is not possible without custom JavaScript. You will need to disable validation on the fields you want to validate. Then write custom client side validation when the field is ...
3
votes
The constructor to deserialize an object of type is not found
As mentioned in the comments, the constructors are mandatory. You are inheriting from StandardValidator which ultimately inherits from a class implementing ISerializable. On this we know:
The ...
3
votes
Accepted
How do i validate an image for byte-size in Content Editor?
As Mark Cassidy explained, you can only achieve this via the implementation of a custom validation rule. Please see below the code for the custom validation.
[Serializable]
public class ...
3
votes
Accepted
Markup button under proofing tab is not working in preview mode
When you click the "Markup" button, what should happen is that the page sitecore/shell/Applications/Content Manager/Validator.aspx should pop up and all Rich-Text content stored in fields that live on ...
3
votes
Accepted
"Linked Item Has Allowed Template" Field Validation XP 8.2
“Linked Item Has Allowed Template” Field Validator is working as expected for Droptree field.
You need to add DataSource=/sitecore/content/Home&IncludeTemplatesForSelection=Template Name in Source ...
3
votes
Allow all characters in ItemNameValidation setting
There are 2 settings that control item names during package installation:
InvalidItemNameChars should be blank.
ItemNameValidation should be .*
With this settings you should be able to install ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
validation × 86sitecore-forms × 15
content-editor × 11
wffm × 10
sxa × 8
sitecore-client × 8
experience-editor × 6
workflow × 4
custom-field × 3
field × 3
regex × 3
publishing × 2
templates × 2
richtext-editor × 2
rules-engine × 2
javascript × 2
rendering-parameters × 2
xm-cloud × 2
jss × 1
configuration × 1
media-library × 1
pipelines × 1
packages × 1
fieldtype × 1
links × 1