# TelamonUrlValidator

> A validator for a text field that accepts a URL with one of a set of schemes.

TelamonUrlValidator is a `QValidator` for a field's `validator`. Acceptable text is a complete URL whose scheme is in `schemes`; `http` and `https` also need a host. Pair it with `TelamonTextField.invalidText` ([TelamonTextField](https://telamon.eterneon.net/framework/telamon-ui/telamon-text-field.md)) so the field says what is wrong.

Since 1.5.0: a bare host such as `example.com` (or `example.com:8080/a`) is Intermediate when the first scheme is `http` or `https`, and `fixup()` puts that scheme in front of it ("https://example.com"), so the user can type it.

Like the other Telamon validators ([TelamonEmailValidator](https://telamon.eterneon.net/framework/telamon-ui/telamon-email-validator.md), [TelamonPathValidator](https://telamon.eterneon.net/framework/telamon-ui/telamon-path-validator.md), [TelamonNumberValidator](https://telamon.eterneon.net/framework/telamon-ui/telamon-number-validator.md)) it rejects text over a fixed length, uses no regular expressions and rejects NUL and other control characters. Intermediate means the user can still type a valid URL.

## Example

```qml
TelamonTextField {
    validator: TelamonUrlValidator { schemes: ["https"] }
    invalidText: qsTr("Enter a web address starting with https://")
}
```

## Properties

| Name | Type | Default | Description |
|---|---|---|---|
| `schemes` | `list<string>` | `["https"]` | The accepted URL schemes, without the colon, matched without regard to case. An empty list makes every non-empty text Invalid. |

> [!NOTE]
> Acceptable text is still not safe to splice into a URL or header unencoded. Text with spaces around it is Intermediate until `fixup()` trims it. Text over 2048 characters is Invalid.
