Skip to content

Nullable string property with [Url] attribute #558

@mcockrellsana

Description

@mcockrellsana

Hello,

I noticed an issue with a nullable property for a URL editor field. if you define the property as such:

[Display(Name = "Link To External Url")]
[Url]
[PreviewDescription]
public string? Url { get; set; }

you should be able to have the Url field be empty or blank, however, once you enter data into the field on the UI, then clear it out, you receive the following validation error, not allowing you to save:

Image

Is there anyway to circumvent this, to allow the field to accept the empty string. It seems like it probably and likely is just a bug with the front end validation for the URL control.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions