Semantic-Org/Semantic-UI · error
jquery-serialize-object is required to add form data to an e
Error message
jquery-serialize-object is required to add form data to an existing data object
What it means
This error is logged by the API module's add.formData() function (api.js:425-450) when settings.serializeForm is true, there is existing data to merge (settings.data is a plain object), and the jquery-serialize-object plugin is not loaded. The module uses $.fn.serializeObject() from that plugin to convert form fields to a JSON object; without it, the module cannot merge form data into the existing settings.data and falls back to replacing it entirely.
Source
Thrown at src/definitions/behaviors/api.js:1134
// server error
onError : function(errorMessage, $module) {},
// request aborted
onAbort : function(errorMessage, $module) {},
successTest : false,
// errors
error : {
beforeSend : 'The before send function has aborted the request',
error : 'There was an error with your request',
exitConditions : 'API Request Aborted. Exit conditions met',
JSONParse : 'JSON could not be parsed during error handling',
legacyParameters : 'You are using legacy API success callback names',
method : 'The method you called is not defined',
missingAction : 'API action used but no url was defined',
missingSerialize : 'jquery-serialize-object is required to add form data to an existing data object',
missingURL : 'No URL specified for api event',
noReturnedValue : 'The beforeSend callback must return a settings object, beforeSend ignored.',
noStorage : 'Caching responses locally requires session storage',
parseError : 'There was an error parsing your request',
requiredParameter : 'Missing a required URL parameter: ',
statusMessage : 'Server gave an error: ',
timeout : 'Your request timed out'
},
regExp : {
required : /\{\$*[A-z0-9]+\}/g,
optional : /\{\/\$*[A-z0-9]+\}/g,
},
className: {
loading : 'loading',
error : 'error'
},View on GitHub (pinned to 597843ab84)
Solutions
- Include the jquery-serialize-object plugin before Semantic UI's API module: <script src='jquery.serialize-object.js'></script>.
- If you do not need to merge form data with existing data, set settings.data to a string or remove it so the form data is used directly (the else branch at api.js:446).
- Alternatively, disable settings.serializeForm and serialize form data manually using $(form).serialize().
Example fix
// before
<script src='semantic.min.js'></script>
<script>
$('.form').api({ serializeForm: true, data: { token: 'abc' }, url: '/submit' });
// error: jquery-serialize-object not loaded
</script>
// after
<script src='jquery.js'></script>
<script src='jquery.serialize-object.js'></script>
<script src='semantic.min.js'></script>
<script>
$('.form').api({ serializeForm: true, data: { token: 'abc' }, url: '/submit' });
</script> Defensive patterns
Strategy: validation
Validate before calling
// Check for the serialize-object plugin before enabling serializeForm
var hasSerializeObject = $.fn.serializeObject !== undefined;
$('.el').api({
serializeForm: hasSerializeObject,
url: '/submit'
});
if (!hasSerializeObject) {
console.warn('jquery-serialize-object not loaded; form serialization disabled.');
} Type guard
// Type guard: check if jquery-serialize-object is available
function hasSerializeObjectPlugin() {
return typeof $.fn.serializeObject === 'function';
} Prevention
- Include jquery-serialize-object.js in your build pipeline before Semantic UI.
- Add a feature detection check before enabling serializeForm.
- Manually serialize form data with $(form).serialize() as an alternative.
When it happens
Trigger: Configuring $('.form').api({ serializeForm: true, data: { extra: 'val' } }) without including the jquery-serialize-object script on the page. The canSerialize variable (api.js:428) checks for $.fn.serializeObject and evaluates to false when the plugin is absent.
Common situations: Forgetting to include jquery-serialize-object.js (a separate dependency from Semantic UI core). CDN or build pipeline dropping the serialize-object plugin. Upgrading Semantic UI and not updating the serialize-object dependency version. The plugin script failing to load due to network issues or incorrect script paths.
Related errors
- The before send function has aborted the request
- There was an error with your request
- API Request Aborted. Exit conditions met
- JSON could not be parsed during error handling
- You are using legacy API success callback names
AI-assisted analysis of Semantic-Org/Semantic-UI@597843ab84 (2026-08-13).
Data as JSON: /api/errors/7f2600670ec550c6.
Report an issue: GitHub.