Ape R Us
04/15/2022, 5:40 AMlet num = 0;
let totalAttendees = [];
let attendee = {
id: 1,
first: '',
age: undefined
};
function addPerson() {
total = [...total, attendee];
}
const add = async (totalAttendees) => {
try { const { error } = await supabase.from('name').upsert(totalAttendees);
if (error) throw error;
} catch (e) {
console.log(e.message);
} finally {
console.log('success');
}
};
this is the input to select how much forms should appear
<input type="number" class="bg-transparent" bind:value={num} />
this is me iterating
{#each Array(num) as _, i}
<div>
<input type="text" bind:value={attendee.first} class="bg-transparent" placeholder="first" />
<input type="number" bind:value={attendee.age} class="bg-transparent" placeholder="age" />
<button type="button" on:click={addPerson}>add</button>
</div>
{/each}
it works, however the problem im getting is that when i enter info in any field its updating in all,
is there anyway where each div inputs will be unique so it wont updateNeedle
04/15/2022, 5:40 AM/title
command!
We have solved your problem?
Click the button below to archive it.Ape R Us
04/15/2022, 5:57 AM