Semantic-Org/Semantic-UI · info

Starting in 2.0 forms now only take a single settings object

Error message

Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.

What it means

A migration/deprecation notice logged by Semantic UI Form when it detects the legacy 1.x positional settings shape (an array of objects each with {identifier, rules}). The form behavior auto-converts the legacy parameters into the 2.x single settings object and emits this message via module.error(settings.error.oldSyntax, element) at form.js:479.

Source

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

    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
    prompt: function(errors) {

View on GitHub (pinned to 597843ab84)

Solutions

  1. Migrate to the 2.x single-settings object: $('.ui.form').form({ fields: { ... } }).
  2. Move per-field rules under the 'fields' key in the settings object.
  3. Stop passing two positional arguments; merge callbacks and rules into one options object.

Example fix

// before (1.x)
$('.ui.form').form([
  { identifier: 'email', rules: [{ type: 'empty', prompt: 'Required' }] }
], { inline: true });
// after (2.x)
$('.ui.form').form({
  inline: true,
  fields: { email: { rules: [{ type: 'empty', prompt: 'Required' }] } }
});
Defensive patterns

Strategy: validation

Validate before calling

function isLegacyFormArgs(args) {
  return Array.isArray(args[0]) || (args[0] && args[0].length && args[0][0] && args[0][0].identifier && args[0][0].rules);
}
// before init:
if (isLegacyFormArgs(arguments)) { console.warn('Migrate to 2.x single-settings form() call'); }

Type guard

function isModernSettings(obj) {
  return obj && typeof obj === 'object' && !Array.isArray(obj) && ('fields' in obj || 'on' in obj || 'inline' in obj);
}

Prevention

When it happens

Trigger: Calling $('.ui.form').form(legacyArray, settingsObj) with two positional args where the first is the old per-field rules array. The duck-type check (form.js:470-471) keys off {identifier, rules} on the first element and triggers conversion.

Common situations: Copying example code from old Semantic UI 1.x blog posts/docs; upgrading Semantic UI without updating form init calls; CMS templates that ship legacy form snippets.

Related errors


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