Skip to main content

Quote Form Submit Event

app.on("form:submit", async function (data) {
console.log("Submitting form! Customer data", data);

// Note these fields may change if you request changes to your quote form.
const {
firstName,
lastName,
email,
phoneNumber,
address,
suburb,
postCode,
comment,


/**
* Shed Details, Example:
* Main Structure
* - Roof Type: American Barn
* - Roof Pitch: 22°
* - Length: 13m
* - Width: 4m
* - Height: 4.5m
* - Bays: 4.333m, 4.333m, 4.333m
* - Bay Amount: 3
*
* Extras
* - 1 x Barn Window
* - 1 x PA door 870mm (W) x 2030mm (H)
* - 2 x Roller Door 2.4m (W) x 2.6m (H)
* - 2 x Roller Door 2.992m (W) x 4m (H)
* - 3 x Whirlybird
* - 6 x Window 1274mm (W) x 790mm (H)
* - Wall Insulation: None
* - Roof Insulation: None
*/
details,

// The link to load the shed again: https://webshed.unda.com.au/#fUdukU2WYzn/0
webshedUrl
} = data

//To get the id of the saved shed Use this:
console.log("hash", app.hash) // Logs: fUdukU2WYzn/0

// Shed data
const shedData = await app.toJson();

console.log("Width", shedData.width);
console.log("Height", shedData.height);
console.log("Length", shedData.length);
// Etc

// AJAX POST to external API
postData({
customer: {
firstName,
lastName
},
shedData
})
});

Listen to shed changes

app.on("loaded", async function () {

// Get the shed again
const data = await app.toJson();

// Listen to shed:change event
app.on("shed:change", function (data) {
console.info("Shed updated", data);
});
});