{"record":{"id":"4eda58fc2156bdf0","repo":"Semantic-Org/Semantic-UI","slug":"name-must-be-a-valid-url","errorCode":null,"errorMessage":"{name} must be a valid url","messagePattern":"(.+?) must be a valid url","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/behaviors/form.js","lineNumber":1257,"sourceCode":"    decimal : /^\\d+\\.?\\d*$/,\n    email   : /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,\n    escape  : /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g,\n    flags   : /^\\/(.*)\\/(.*)?/,\n    integer : /^\\-?\\d+$/,\n    number  : /^\\-?\\d*(\\.\\d+)?$/,\n    url     : /(https?:\\/\\/(?:www\\.|(?!www))[^\\s\\.]+\\.[^\\s]{2,}|www\\.[^\\s]+\\.[^\\s]{2,})/i\n  },\n\n  text: {\n    unspecifiedRule  : 'Please enter a valid value',\n    unspecifiedField : 'This field'\n  },\n\n  prompt: {\n    empty                : '{name} must have a value',\n    checked              : '{name} must be checked',\n    email                : '{name} must be a valid e-mail',\n    url                  : '{name} must be a valid url',\n    regExp               : '{name} is not formatted correctly',\n    integer              : '{name} must be an integer',\n    decimal              : '{name} must be a decimal number',\n    number               : '{name} must be set to a number',\n    is                   : '{name} must be \"{ruleValue}\"',\n    isExactly            : '{name} must be exactly \"{ruleValue}\"',\n    not                  : '{name} cannot be set to \"{ruleValue}\"',\n    notExactly           : '{name} cannot be set to exactly \"{ruleValue}\"',\n    contain              : '{name} must contain \"{ruleValue}\"',\n    containExactly       : '{name} must contain exactly \"{ruleValue}\"',\n    doesntContain        : '{name} cannot contain  \"{ruleValue}\"',\n    doesntContainExactly : '{name} cannot contain exactly \"{ruleValue}\"',\n    minLength            : '{name} must be at least {ruleValue} characters',\n    length               : '{name} must be at least {ruleValue} characters',\n    exactLength          : '{name} must be exactly {ruleValue} characters',\n    maxLength            : '{name} cannot be longer than {ruleValue} characters',\n    match                : '{name} must match {ruleValue} field',\n    different            : '{name} must have a different value than {ruleValue} field',","sourceCodeStart":1239,"sourceCodeEnd":1275,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/form.js#L1239-L1275","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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'}]`."],"exampleFix":"// before\n$('.ui.form').form({ fields: { site: { rules: [{ type: 'url' }] } } });\n// user types 'localhost'  ->  'Website must be a valid url'\n\n// after: accept scheme-less / local hosts via custom regex\n$('.ui.form').form({\n  fields: {\n    site: {\n      rules: [{ type: 'regExp[/^(https?:\\/\\/)?([\\w-]+\\.)+[\\w]{2,}([:\\d]+)?(\\/.*)?$/]', prompt: 'Enter a valid website address' }]\n    }\n  }\n});","handlingStrategy":"validation","validationCode":"// Run before .form('validate') / submit\nfunction looksLikeUrl(v) {\n  if (!v) return false;\n  return /^(https?:\\/\\/)?([\\w-]+\\.)+[\\w]{2,}([:\\d]+)?(\\/.*)?$/i.test(v) || /^https?:\\/\\/localhost([:\\d]*)?/i.test(v);\n}\nif (!looksLikeUrl($field.val())) { /* warn user / block submit */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["semantic-ui","form-validation","url","regex","client-side"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}