Skip to content

Commit

Permalink
fix: prevent submit modal when trying to create location with no name
Browse files Browse the repository at this point in the history
  • Loading branch information
filp committed Sep 22, 2024
1 parent 85b54c4 commit d09d59d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion frontend/components/Form/TextField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
<label class="label">
<span class="label-text">{{ label }}</span>
</label>
<input ref="input" v-model="value" :placeholder="placeholder" :type="type" class="input input-bordered w-full" />
<input
ref="input"
v-model="value"
:placeholder="placeholder"
:type="type"
:required="required"
class="input input-bordered w-full"
/>
</div>
<div v-else class="sm:grid sm:grid-cols-4 sm:items-start sm:gap-4">
<label class="label">
Expand All @@ -23,6 +30,10 @@
type: [String, Number],
default: null,
},
required: {
type: [Boolean],
default: null,
},
type: {
type: String,
default: "text",
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/Location/CreateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
v-model="form.name"
:trigger-focus="focused"
:autofocus="true"
:required="true"
label="Location Name"
/>
<FormTextArea v-model="form.description" label="Location Description" />
Expand All @@ -18,7 +19,7 @@
<label tabindex="0" class="btn rounded-l-none rounded-r-xl">
<MdiChevronDown class="size-5" />
</label>
<ul tabindex="0" class="dropdown-content menu rounded-box right-0 w-64 bg-base-100 p-2 shadow">
<ul tabindex="0" class="dropdown-content menu rounded-box bg-base-100 right-0 w-64 p-2 shadow">
<li>
<button type="button" @click="create(false)">{{ $t("global.create_and_add") }}</button>
</li>
Expand Down

0 comments on commit d09d59d

Please sign in to comment.