Semantic-Org/Semantic-UI · warning

{name} must contain exactly "{ruleValue}"

Error message

{name} must contain exactly "{ruleValue}"

What it means

Default prompt keyed under `containExactly` (form.js:1267). Same naming mismatch as `contain`: the rule function is `containsExactly` (form.js:1465, case-SENSITIVE substring), so `settings.prompt['containExactly']` is only reached if ruleName is `containExactly`, which has no matching rule function. Using the working type `containsExactly[...]` makes the prompt lookup miss and fall back to `unspecifiedRule`.

Source

Thrown at src/definitions/behaviors/form.js:1267

    unspecifiedRule  : 'Please enter a valid value',
    unspecifiedField : 'This field'
  },

  prompt: {
    empty                : '{name} must have a value',
    checked              : '{name} must be checked',
    email                : '{name} must be a valid e-mail',
    url                  : '{name} must be a valid url',
    regExp               : '{name} is not formatted correctly',
    integer              : '{name} must be an integer',
    decimal              : '{name} must be a decimal number',
    number               : '{name} must be set to a number',
    is                   : '{name} must be "{ruleValue}"',
    isExactly            : '{name} must be exactly "{ruleValue}"',
    not                  : '{name} cannot be set to "{ruleValue}"',
    notExactly           : '{name} cannot be set to exactly "{ruleValue}"',
    contain              : '{name} must contain "{ruleValue}"',
    containExactly       : '{name} must contain exactly "{ruleValue}"',
    doesntContain        : '{name} cannot contain  "{ruleValue}"',
    doesntContainExactly : '{name} cannot contain exactly "{ruleValue}"',
    minLength            : '{name} must be at least {ruleValue} characters',
    length               : '{name} must be at least {ruleValue} characters',
    exactLength          : '{name} must be exactly {ruleValue} characters',
    maxLength            : '{name} cannot be longer than {ruleValue} characters',
    match                : '{name} must match {ruleValue} field',
    different            : '{name} must have a different value than {ruleValue} field',
    creditCard           : '{name} must be a valid credit card number',
    minCount             : '{name} must have at least {ruleValue} choices',
    exactCount           : '{name} must have exactly {ruleValue} choices',
    maxCount             : '{name} must have {ruleValue} or less choices'
  },

  selector : {
    checkbox   : 'input[type="checkbox"], input[type="radio"]',
    clear      : '.clear',
    field      : 'input, textarea, select',

View on GitHub (pinned to 597843ab84)

Solutions

  1. Use `containsExactly[...]` and set an explicit `prompt`.
  2. Add an alias: `$.fn.form.settings.rules.containExactly = $.fn.form.settings.rules.containsExactly;`.
  3. Verify with a case-correct test input.

Example fix

// before
rules: [{ type: 'containsExactly[Abc]' }]  // generic fallback shown

// after
rules: [{ type: 'containsExactly[Abc]', prompt: 'Must contain exactly "Abc"' }]
Defensive patterns

Strategy: validation

Validate before calling

const needle = 'Abc';
if (($field.val() || '').indexOf(needle) === -1) { /* warn (case-sensitive) */ }

Type guard

const usesContainsExactlyRule = (rule) => /^containsExactly(\[.*\])?$/.test(rule.type || '');

Prevention

When it happens

Trigger: Intended: `{type:'containsExactly[Abc]'}` with input not containing `Abc` with that casing. Actual: generic fallback message shown unless an explicit prompt is set.

Common situations: Case-sensitive token checks where the friendly message never appears; developers assuming the default message is broken.

Related errors


AI-assisted analysis of Semantic-Org/Semantic-UI@597843ab84 (2026-08-13). Data as JSON: /api/errors/8bd724ce1f545d51. Report an issue: GitHub.