Now we have a working version without any JS. Way easier to do because javascript form submit blows hot wads.

This commit is contained in:
Zed A. Shaw 2025-07-27 01:44:45 -04:00
parent 3fd8169d83
commit 504433502a
3 changed files with 33 additions and 21 deletions

View file

@ -1,17 +1,5 @@
<script>
let Data = new GetJson("/api/admin/table/{{ .Table }}/{{ .Id }}/");
const PostForm = async (url, data) => {
console.log("DATA", JSON.stringify(data));
return await fetch(url, {
method: "POST",
mode: "same-origin",
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json'
}
});
}
</script>
<blockstart>
@ -25,14 +13,14 @@
<template x-for="(value, key) in item">
<div>
<label x-text="key" x-bind:for="key"></label>
<input x-text="value" x-model="item[key]" x-bind:id="key" />
<input x-bind:name="key" x-text="value" x-model="item[key]" x-bind:id="key" />
</div>
</template>
</middle>
<bottom>
<button-group>
<button type="button">Back</button>
<button type="button" @click.prevent="PostForm('/api/admin/table/{{ .Table }}/{{ .Id }}/', item)">Update</button>
<button type="submit">Update</button>
<button type="button" @click.prevent="console.log('DELETE', item.id)">Delete</button>
</button-group>
</bottom>