Fix Form Display
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<script lang="ts" setup>
|
||||
import RitzenbergenLib from "../../ritzenbergenlib";
|
||||
import FormResults from "../FormResults.vue";
|
||||
import { ref, defineProps } from "vue";
|
||||
import { ref } from "vue";
|
||||
import Modal from "../Modal.vue";
|
||||
import { Formular } from "../../dto/formular.dto";
|
||||
|
||||
async function init() {
|
||||
forms.value=await RitzenbergenLib.graphqlClient.request<Formular[]>(`
|
||||
forms.value=await RitzenbergenLib.graphqlClient.request<{formulare: Formular[] }>(`
|
||||
{
|
||||
formulare {
|
||||
id
|
||||
@@ -15,7 +15,6 @@ async function init() {
|
||||
ispublic
|
||||
fields {
|
||||
id
|
||||
formular
|
||||
name
|
||||
displayname
|
||||
displayvalue
|
||||
@@ -32,7 +31,9 @@ async function init() {
|
||||
}
|
||||
}
|
||||
`
|
||||
);
|
||||
).then(data=>data.formulare);
|
||||
|
||||
console.log(forms.value);
|
||||
}
|
||||
|
||||
const forms = ref([] as Formular[]);
|
||||
@@ -51,16 +52,13 @@ function submit($event: Event) {
|
||||
const url = new URL(
|
||||
RitzenbergenLib.RitzenbergenLib.api("/formulare/submit.php")
|
||||
);
|
||||
const formData = new FormData($event.target);
|
||||
const formData = new FormData(<HTMLFormElement>$event.target);
|
||||
fetch(url.toString(), {
|
||||
method: "POST",
|
||||
body: formData
|
||||
}).then(() => {
|
||||
forms.value = Formular.getForms().then((f) => {
|
||||
forms.value = f;
|
||||
});
|
||||
|
||||
values.value={};
|
||||
}).then(() => {
|
||||
init();
|
||||
values.value={};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,7 +79,7 @@ const values=ref({});
|
||||
</Modal>
|
||||
<section ref="anmeldeformular" id="anmeldeformular">
|
||||
<section class="form5 cid-u6k7q0BfGa">
|
||||
<div class="container" v-for="(form, i) in forms.filter((form)=>form.id==props.formid||props.id==null)" :key="form">
|
||||
<div class="container" v-for="(form, i) in forms" :key="i">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 content-head">
|
||||
<div class="mbr-section-head mb-5">
|
||||
@@ -111,7 +109,7 @@ const values=ref({});
|
||||
:data-i="i"
|
||||
@submit.prevent="submit"
|
||||
>
|
||||
<div v-for="(field, j) in form.fields" :key="field">
|
||||
<div v-for="(field, j) in form.fields" :key="j">
|
||||
<label
|
||||
v-if="field.placeholder == null"
|
||||
:for="'field-' + field.id"
|
||||
|
||||
Reference in New Issue
Block a user