Bug fixes for form save. Use custom preventDefault function.
This commit is contained in:
@@ -133,7 +133,7 @@ let lq__archive_content_obj = $derived(liveQuery(async () => {
|
|||||||
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if ($idaa_trig.archive_content_li) {
|
if ($idaa_trig.archive_content_li) {
|
||||||
$idaa_trig.archive_content_li = false;
|
$idaa_trig.archive_content_li = false;
|
||||||
|
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
@@ -176,7 +176,7 @@ $effect(() => {
|
|||||||
log_lvl: log_lvl,
|
log_lvl: log_lvl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (browser) {
|
if (browser) {
|
||||||
console.log('Browser environment detected.');
|
console.log('Browser environment detected.');
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { run, preventDefault } from 'svelte/legacy';
|
import { run } from 'svelte/legacy';
|
||||||
|
|
||||||
// *** Import Svelte core
|
// *** Import Svelte core
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
@@ -112,11 +112,12 @@ if (lu_time_zone_list && lu_time_zone_list.length > 0) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function preventDefault(fn) {
|
||||||
onMount(() => {
|
return function (event) {
|
||||||
console.log('** Component Mounted: ** ID - Archive Content Obj - Edit');
|
event.preventDefault();
|
||||||
});
|
fn.call(this, event);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
async function handle_submit_form(event) {
|
async function handle_submit_form(event) {
|
||||||
if (log_lvl > 1) {
|
if (log_lvl > 1) {
|
||||||
@@ -304,10 +305,10 @@ async function handle_hosted_files_uploaded(hosted_file_id_li: string[], hosted_
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
run(() => {
|
$effect(() => {
|
||||||
if ($idaa_slct.archive_content_obj?.upload_complete && $idaa_slct.archive_content_obj?.hosted_file_id_li?.length && $idaa_slct.archive_content_obj.hosted_file_obj_li?.length) {
|
if ($idaa_slct.archive_content_obj?.upload_complete && $idaa_slct.archive_content_obj?.hosted_file_id_li?.length && $idaa_slct.archive_content_obj.hosted_file_obj_li?.length) {
|
||||||
handle_hosted_files_uploaded($idaa_slct.archive_content_obj.hosted_file_id_li, $idaa_slct.archive_content_obj.hosted_file_obj_li);
|
handle_hosted_files_uploaded($idaa_slct.archive_content_obj.hosted_file_id_li, $idaa_slct.archive_content_obj.hosted_file_obj_li);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let slct_hosted_file_id: any = $state(null);
|
let slct_hosted_file_id: any = $state(null);
|
||||||
@@ -342,15 +343,17 @@ $effect(() => {
|
|||||||
slct_hosted_file_obj = null;
|
slct_hosted_file_obj = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<section
|
<section
|
||||||
class="svelte_component ae_edit archive_content_obj"
|
class="svelte_component ae_edit archive_content_obj"
|
||||||
class:ae_create={!$idaa_slct.archive_content_id}
|
class:ae_create={!$idaa_slct.archive_content_id}
|
||||||
>
|
>
|
||||||
<!-- bind:clientHeight={ae_iframe_height} -->
|
<!-- bind:clientHeight={ae_iframe_height} -->
|
||||||
|
|
||||||
<form onsubmit={preventDefault(handle_submit_form)} class="space-y-2">
|
<form onsubmit={preventDefault(handle_submit_form)} class="space-y-1">
|
||||||
|
|
||||||
{#await prom_api__archive_content_obj}
|
{#await prom_api__archive_content_obj}
|
||||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ if (lu_time_zone_list && lu_time_zone_list.length > 0) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function preventDefault(fn) {
|
||||||
onMount(() => {
|
return function (event) {
|
||||||
console.log('** Component Mounted: ** ID - Archive Obj - Edit');
|
event.preventDefault();
|
||||||
});
|
fn.call(this, event);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
async function handle_submit_form(event) {
|
async function handle_submit_form(event) {
|
||||||
if (log_lvl > 1) {
|
if (log_lvl > 1) {
|
||||||
@@ -285,7 +285,7 @@ async function handle_delete_archive_obj(
|
|||||||
bind:clientHeight={$ae_loc.iframe_height_modal_body}
|
bind:clientHeight={$ae_loc.iframe_height_modal_body}
|
||||||
>
|
>
|
||||||
|
|
||||||
<form onsubmit={handle_submit_form} class="space-y-2">
|
<form onsubmit={preventDefault(handle_submit_form)} class="space-y-1">
|
||||||
|
|
||||||
{#await update_archive_obj_promise}
|
{#await update_archive_obj_promise}
|
||||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||||
@@ -646,9 +646,16 @@ async function handle_delete_archive_obj(
|
|||||||
if (!confirm('Are you sure you want to delete this archive?')) {return false;}
|
if (!confirm('Are you sure you want to delete this archive?')) {return false;}
|
||||||
handle_delete_archive_obj({archive_id: $idaa_slct.archive_id});
|
handle_delete_archive_obj({archive_id: $idaa_slct.archive_id});
|
||||||
}}
|
}}
|
||||||
class="novi_btn btn btn-sm preset-tonal-warning"
|
class="
|
||||||
|
novi_btn
|
||||||
|
btn btn-sm
|
||||||
|
preset-filled-warning-200-800 hover:preset-filled-error-200-800
|
||||||
|
transition
|
||||||
|
"
|
||||||
|
title="Disable this archive content"
|
||||||
>
|
>
|
||||||
<span class="fas fa-minus m-1"></span> Delete
|
<span class="fas fa-minus m-1"></span>
|
||||||
|
Delete
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -66,6 +66,13 @@ let upload_complete = $state(false);
|
|||||||
let disable_submit_btn = $state(false);
|
let disable_submit_btn = $state(false);
|
||||||
|
|
||||||
|
|
||||||
|
function preventDefault(fn) {
|
||||||
|
return function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
fn.call(this, event);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
async function handle_submit_form(event: any) {
|
async function handle_submit_form(event: any) {
|
||||||
if (log_lvl > 1) {
|
if (log_lvl > 1) {
|
||||||
console.log('*** handle_submit_form() ***', event.target);
|
console.log('*** handle_submit_form() ***', event.target);
|
||||||
@@ -349,17 +356,6 @@ function send_staff_notification_email() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// function preventDefault(
|
|
||||||
// fn: (event: Event, ...args: Array<unknown>) => void
|
|
||||||
// ): (event: Event, ...args: unknown[]) => void;
|
|
||||||
|
|
||||||
function preventDefault(fn) {
|
|
||||||
return function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
fn.call(this, event);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (orig_post_obj === null || orig_post_obj === undefined || orig_post_obj === 'undefined') {
|
if (orig_post_obj === null || orig_post_obj === undefined || orig_post_obj === 'undefined') {
|
||||||
obj_changed = false;
|
obj_changed = false;
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ if (lu_country_subdivision_list && lu_country_subdivision_list.length > 50 && Ma
|
|||||||
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if ($idaa_slct.event_obj) {
|
if ($idaa_slct.event_obj) {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log('Selected Event object changed?', $idaa_slct.event_obj);
|
console.log('Selected Event object changed?', $idaa_slct.event_obj);
|
||||||
}
|
}
|
||||||
@@ -256,8 +256,14 @@ $effect(() => {
|
|||||||
disable_submit_btn = false;
|
disable_submit_btn = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function preventDefault(fn) {
|
||||||
|
return function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
fn.call(this, event);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
async function handle_submit_form(event: any) {
|
async function handle_submit_form(event: any) {
|
||||||
console.log('*** handle_submit_form() ***');
|
console.log('*** handle_submit_form() ***');
|
||||||
@@ -629,22 +635,6 @@ function send_staff_notification_email() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
<div>
|
|
||||||
Poster's Novi ID: ${$idaa_slct.event_obj.external_person_id ?? '-- not set --'}<br>
|
|
||||||
Poster's Name: ${$idaa_slct.event_obj.full_name ?? '-- not set --'}<br>
|
|
||||||
Poster's Email: ${$idaa_slct.event_obj.email ?? '-- not set --'}
|
|
||||||
</div>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function preventDefault(fn) {
|
|
||||||
return function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
fn.call(this, event);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (orig_event_obj === null || orig_event_obj === undefined || orig_event_obj === 'undefined') {
|
if (orig_event_obj === null || orig_event_obj === undefined || orig_event_obj === 'undefined') {
|
||||||
obj_changed = false;
|
obj_changed = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user