So, Here is the the page: https://www.onetribeconference.com/registration
I am wanting parents to register their children for child care. The problem is once they put their personal information (parentFN, parentLN, parentPhone) I want them to add a child (childFN, childLN). When they click “Add a Child” button (addChild) I want that entry to be saved into the collection, once the page (automatically, as I can’t stop it, refreshes) the parent information is erased.
I need to have the Add Child button save the record (row) into the collection Child. Then the child fields return to the placeholder but the parent information remain visible. Then if the parent clicks finish, THEN… the page can refresh (or save normally triggering a refresh and all fields by default go bacl to their placeholder.
I tried to use this logic, but as soon as the save command gets executed, it refreshes the page. I also tried to save the parentFN and parent LN into a variable but it’s not available globally so that once the page refreshes, the input field can insert those variables. Please show me some examples as I’ve been trying for a couple of days. Thanks, Marti.
import wixData from “wix-data”;
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
$w.onReady(function () {
//TODO: write your page related code here…
});
export function oneMore_onClick() {
if ($w(‘#parentFN’).value !== “”) {
let pFN = $w(‘#parentFN’).value;
let pLN = $w(‘#parentLN’).value;
$w(‘#childInfo’).save(oneMore_onClick());
console.log(“Child Saved”);
$w.onReady(function () {
$w(“#parentFN”).value = pFN;
$w(“#parentLN”).value = pLN;
});
} else {
console.log("Name Missing");
}
}
export function finished_onCLick() {
$w(“#parentFN”).value = “First Name0022”; //test to see if it changes, yes but not as expected
$w(‘#parentLN’).placeholder = “Last Name00”;
$w(‘#childFN’).placeholder = “First Name00”;
$w(‘#childLN’).placeholder = “Last Name00”;
}