Skip to content

Allow values to be reset to null when field is not required #2017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
export let label: string;
export let value: string | null;
export let attribute: Models.AttributeUrl;

$: nullable = attribute.required ? false : !value;
</script>

<InputEmail
{id}
{label}
{nullable}
nullable={!attribute.required}
placeholder="Enter URL"
required={attribute.required}
bind:value />
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
export let label: string;
export let value: number;
export let attribute: Models.AttributeInteger;

$: nullable = attribute.required ? false : !value;
</script>

<InputNumber
{id}
{label}
{nullable}
nullable={!attribute.required}
required={attribute.required}
min={attribute.min}
max={attribute.max}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
export let label: string;
export let value: string;
export let attribute: Models.AttributeString;

$: nullable = attribute.required ? false : !value;
</script>

{#if attribute.size >= 50}
<InputTextarea
{id}
{label}
{nullable}
nullable={!attribute.required}
placeholder="Enter string"
required={attribute.required}
maxlength={attribute.size}
Expand All @@ -23,7 +21,7 @@
<InputText
{id}
{label}
{nullable}
nullable={!attribute.required}
placeholder="Enter string"
required={attribute.required}
maxlength={attribute.size}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
export let label: string;
export let value: string | null;
export let attribute: Models.AttributeUrl;

$: nullable = attribute.required ? false : !value;
</script>

<InputURL
{id}
{label}
{nullable}
nullable={!attribute.required}
placeholder="Enter URL"
required={attribute.required}
bind:value />