Semantic-Org/Semantic-UI · warning

{name} must be "{ruleValue}"

Error message

{name} must be "{ruleValue}"

What it means

Default prompt for the Semantic UI Form `is` rule (settings.rules.is, form.js:1422). It performs case-INSENSITIVE equality between the field value and the required text (`{ruleValue}`), both lowercased before comparison. Shown when they differ.

Source

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

    number  : /^\-?\d*(\.\d+)?$/,
    url     : /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i
  },

  text: {
    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'
  },

View on GitHub (pinned to 597843ab84)

Solutions

  1. Match the expected value (case-insensitive).
  2. If case sensitivity is required, use the `isExactly` rule.
  3. Trim the ruleValue or remove stray spaces inside the brackets.
  4. Add a custom `prompt` naming the expected value.

Example fix

// before
rules: [{ type: 'is[ accept ]' }]  // spaces inside brackets are part of ruleValue

// after
rules: [{ type: 'is[accept]', prompt: 'You must type "accept"' }]
Defensive patterns

Strategy: validation

Validate before calling

const expected = 'accept';
if (($field.val() || '').trim().toLowerCase() !== expected.trim().toLowerCase()) { /* warn */ }

Type guard

const matchesCaseInsensitive = (v, t) => String(v).trim().toLowerCase() === String(t).trim().toLowerCase();

Prevention

When it happens

Trigger: `{type:'is[yes]'}` with input `no`, `y`, or `Yes ` (trailing space — note `$.trim` is applied to the value at form.js:1031, so leading/trailing whitespace on the value is trimmed, but not on the ruleValue).

Common situations: Confirm-field style rules where exact case matters (use `isExactly` instead), or where the expected token has surrounding whitespace inside the brackets.

Related errors


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