Semantic-Org/Semantic-UI · error

There is no rule matching the one you specified

Error message

There is no rule matching the one you specified

What it means

Semantic UI Form validation error raised in validate.rule (form.js:1024-1025) when a rule's type does not resolve to a function in settings.rules. The validator looks up settings.rules[ruleName]; if undefined/$.isFunction is false, it logs this error and returns early, skipping that field's validation.

Source

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

    prompt     : '.prompt.label',
    radio      : 'input[type="radio"]',
    reset      : '.reset:not([type="reset"])',
    submit     : '.submit:not([type="submit"])',
    uiCheckbox : '.ui.checkbox',
    uiDropdown : '.ui.dropdown'
  },

  className : {
    error   : 'error',
    label   : 'ui prompt label',
    pressed : 'down',
    success : 'success'
  },

  error: {
    identifier : 'You must specify a string identifier for each field',
    method     : 'The method you called is not defined.',
    noRule     : 'There is no rule matching the one you specified',
    oldSyntax  : 'Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.'
  },

  templates: {

    // template that produces error message
    error: function(errors) {
      var
        html = '<ul class="list">'
      ;
      $.each(errors, function(index, value) {
        html += '<li>' + value + '</li>';
      });
      html += '</ul>';
      return $(html);
    },

    // template that produces label

View on GitHub (pinned to 597843ab84)

Solutions

  1. Compare the rule type string against the keys in $.fn.form.settings.rules to confirm it is registered.
  2. Register custom rules under $.fn.form.settings.rules.myRule = function(value){...} before referencing type:'myRule'.
  3. Fix typos in built-in rule names; remove rule entries that no longer ship in the installed version.

Example fix

// before
$.fn.form.settings.rules.strongPw = function(v){ return v.length>=12; };
$('.ui.form').form({ fields: { pw: { rules: [{ type: 'strongpw' }] } } }); // case mismatch
// after
$('.ui.form').form({ fields: { pw: { rules: [{ type: 'strongPw' }] } } });
Defensive patterns

Strategy: validation

Validate before calling

function ruleExists(name) {
  var rules = $.fn.form.settings && $.fn.form.settings.rules;
  return !!rules && typeof rules[name] === 'function';
}
Object.keys(formConfig.fields).forEach(function(id){
  formConfig.fields[id].rules.forEach(function(r){
    if (!ruleExists(r.type.replace(/\[.*\]$/, ''))) {
      console.error('Unknown validation rule:', r.type, 'on field', id);
    }
  });
});

Type guard

function isRegisteredRule(name) {
  var rules = $.fn.form.settings && $.fn.form.settings.rules;
  return !!(rules && Object.prototype.hasOwnProperty.call(rules, name) && typeof rules[name] === 'function');
}

Prevention

When it happens

Trigger: Declaring rules:[{type:'emailAdress'}] (typo), referencing a custom rule before adding it via form settings.rules, or using a rule name from a newer/older Semantic UI version that doesn't exist in the loaded build.

Common situations: Typos in built-in rule names (email, minLength, isExactly, etc.); defining a custom rule function under settings.rules but misspelling the key used in the field config; bundling only a subset of the form behavior.

Related errors


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