Semantic-Org/Semantic-UI · warning

{name} must match {ruleValue} field

Error message

{name} must match {ruleValue} field

What it means

Default prompt for the Semantic UI Form `match` rule (settings.rules.match, form.js:1518). Requires the field value to equal the value of ANOTHER field, located by `data-validate`, then `#id`, then `[name=]`, then `[name=[]]` (form.js:1523-1534). Comparison is stringified and strict-`==`. The rule returns FALSE (failing) when the target field cannot be found, so a misnamed identifier produces this prompt.

Source

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

    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',
    group      : '.field',
    input      : 'input',
    message    : '.error.message',
    prompt     : '.prompt.label',
    radio      : 'input[type="radio"]',
    reset      : '.reset:not([type="reset"])',
    submit     : '.submit:not([type="submit"])',

View on GitHub (pinned to 597843ab84)

Solutions

  1. Make the two field values identical.
  2. Ensure the bracket identifier matches the other field's `data-validate`, `id`, or `name` attribute (checked in that order).
  3. Prefer using `data-validate="identifier"` on the target to avoid id/name ambiguity.
  4. Add a custom `prompt` naming the field to match.

Example fix

// before - target has id 'passwordConfirm' but rule references 'password-confirm'
rules: [{ type: 'match[password-confirm]' }]

// after - align identifiers via data-validate
// <input data-validate="password-confirm" id="passwordConfirm">
rules: [{ type: 'match[password-confirm]', prompt: 'Passwords must match' }]
Defensive patterns

Strategy: validation

Validate before calling

function resolveField(id) {
  return $('[data-validate="'+id+'"]').val() ?? $('#'+id).val() ?? $('[name="'+id+'"]').val();
}
const other = resolveField('password-confirm');
if (other === undefined || String($field.val()) !== String(other)) { /* warn */ }

Type guard

const targetFieldExists = (id) => $('[data-validate="'+id+'"]').length || $('#'+id).length || $('[name="'+id+'"]').length;

Prevention

When it happens

Trigger: `{type:'match[password-confirm]'}` where the confirm field's value differs, OR the identifier `password-confirm` does not match any `data-validate`/id/name in the form (target missing → returns false → prompt shown).

Common situations: Password/confirm-password pairs; the target field uses a different id vs name; the bracket identifier has a typo or trailing space.

Related errors


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