0

I have applied some validation rules in template standard value as below.

enter image description here

When I am trying to create data item based on this template, rules are not kicking in and data is saved with empty Title field.

Is there anything that I am missing?

1
  • Did you also set the validation rules for the Validate Button, the Validator Bar, and (if you are using it) Workflow? Jun 21 at 7:39
1

First thing, you have selected your rules in the Quick action bar, which means Validation issues appear in the Quick Action Bar on the left in Content Editor. To see the error while saving the item, you'll need to select the rule in Validation Bar for the field: enter image description here

Then, you will need to pass the Fatal Result parameter in the rule item (/sitecore/system/Settings/Validation Rules/Field Rules/Required)

The Result parameter determines the default result value of validation. Possible values are:

  • Valid = Green, everything is fine
  • Suggestion = Bright Orange, hmm, take a look at this
  • Warning = Orange, you should do something about this
  • Error = Red, this is an error you know
  • CriticalError = Red, user is warned before saving
  • FatalError = Red, user cannot save item before validator is cleared

enter image description here

Now, after doing this, if you save an item without entering a value in field, you will get this pop up:

enter image description here

0

Validation options are available in the validation rules section of the data template's standard value and template field definitions. From your image and questions, it looks like you are using field-level validation not item-level validation. Sitecore has a set of default validation options in the validation rules section. These validations will not stop you to save the items by default but will show you errors in different sections. see below image for different section - enter image description here

I guess you are adding validation in "Quick Action Bar" only, in this case, you will see the errors in the quick action bar only which you can enable by right-clicking in the left section in the content editor. - enter image description here

If you have a requirement to not save the items with the validation, you need to update the parameter field of the validation rule, I would suggest you, create a custom validation rule and not update the existing OOTB rule for it. but the process will be as below -

  • Create or select the field validation rule from - /sitecore/system/Settings/Validation Rules/Field Rules (e.g. Required)
  • Navigate to the Data section and in the parameters, field add Result=FatalError

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.