Semantic-Org/Semantic-UI · warning
{name} must be a valid url
Error message
{name} must be a valid url What it means
Default user-facing validation prompt for the Semantic UI Form `url` rule (settings.rules.url, form.js:1352). It is NOT a thrown exception — it is the message rendered into the `.prompt.label` next to a field when `module.validate.rule` returns false and no custom `rule.prompt` was supplied (resolved at form.js:442 via `settings.prompt['url']`). The check tests the value against `settings.regExp.url`, which requires an `http(s)://` scheme or a `www.` prefix plus a TLD of at least two characters (form.js:1245).
Source
Thrown at src/definitions/behaviors/form.js:1257
decimal : /^\d+\.?\d*$/,
email : /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,
escape : /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
flags : /^\/(.*)\/(.*)?/,
integer : /^\-?\d+$/,
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',View on GitHub (pinned to 597843ab84)
Solutions
- Enter a fully-qualified URL matching the regex, e.g. `https://example.com` or `www.example.com`.
- If you must accept local/custom hosts, switch the rule to a custom regex: `{type:'regExp[/^(https?:\/\/)?[\w.-]+(:\d+)?(\/.*)?$/]'}`.
- Globally relax the pattern before init: `$.fn.form.settings.regExp.url = /your-pattern/i;`.
- Override only the message per-field with `rules:[{type:'url', prompt:'Enter a valid website address'}]`.
Example fix
// before
$('.ui.form').form({ fields: { site: { rules: [{ type: 'url' }] } } });
// user types 'localhost' -> 'Website must be a valid url'
// after: accept scheme-less / local hosts via custom regex
$('.ui.form').form({
fields: {
site: {
rules: [{ type: 'regExp[/^(https?:\/\/)?([\w-]+\.)+[\w]{2,}([:\d]+)?(\/.*)?$/]', prompt: 'Enter a valid website address' }]
}
}
}); Defensive patterns
Strategy: validation
Validate before calling
// Run before .form('validate') / submit
function looksLikeUrl(v) {
if (!v) return false;
return /^(https?:\/\/)?([\w-]+\.)+[\w]{2,}([:\d]+)?(\/.*)?$/i.test(v) || /^https?:\/\/localhost([:\d]*)?/i.test(v);
}
if (!looksLikeUrl($field.val())) { /* warn user / block submit */ } Prevention
- Pre-fill the scheme (https://) in the input so users rarely type a bare host.
- Override $.fn.form.settings.regExp.url once at app init if you accept intranet hosts.
- Always set an explicit per-rule prompt so failures are actionable.
When it happens
Trigger: A field configured with `{identifier:'website', rules:[{type:'url'}]}` whose entered value has no protocol/TLD: `localhost`, `example`, `ftp://files.example.org`, `mailto:a@b.com`, or `intranet-host` (no dot). Any value failing `regExp.url.test(value)` causes `module.get.prompt` to return this string.
Common situations: Localhost / intranet / LAN URLs during dev, deep links without a scheme, custom protocol URLs, or values pasted without `https://`. Also triggered when `{ruleValue}`/`{name}` placeholders are misconfigured, but for this rule there are none.
Related errors
- {name} is not formatted correctly
- {name} must be an integer
- {name} must be a decimal number
- {name} must be set to a number
- {name} must be "{ruleValue}"
AI-assisted analysis of Semantic-Org/Semantic-UI@597843ab84 (2026-08-13).
Data as JSON: /api/errors/4eda58fc2156bdf0.
Report an issue: GitHub.