Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How would i get this to put alert that says thank you for your order name inserted into contact we will have your pie size

How would i get this to put alert that says thank you for your order "name inserted into contact" we will have your "pie size with filling type" ready shortly when the user would hit submit

Pie Order Form

Make your Pie!







Contact Details





Return to Class Menu

var cake_prices = new Array(); cake_prices["Round6"]=20; cake_prices["Round8"]=25; cake_prices["Round10"]=35; cake_prices["Round12"]=75; var filling_prices= new Array(); filling_prices["None"]=0; filling_prices["Lemon"]=5; filling_prices["Custard"]=5; filling_prices["Fudge"]=7; filling_prices["Mocha"]=8; filling_prices["Raspberry"]=10; filling_prices["Pineapple"]=5; filling_prices["Dobash"]=9; filling_prices["Mint"]=5; filling_prices["Cherry"]=5; filling_prices["Apricot"]=8; filling_prices["Buttercream"]=7; filling_prices["Chocolate Mousse"]=12;

function getCakeSizePrice() { var cakeSizePrice=0; var theForm = document.forms["cakeform"]; var selectedCake = theForm.elements["selectedcake"]; for(var i = 0; i < selectedCake.length; i++) { if(selectedCake[i].checked) { cakeSizePrice = cake_prices[selectedCake[i].value]; break; } } return cakeSizePrice; }

function getFillingPrice() { var cakeFillingPrice=0; var theForm = document.forms["cakeform"]; var selectedFilling = theForm.elements["filling"]; cakeFillingPrice = filling_prices[selectedFilling.value]; return cakeFillingPrice; }

function candlesPrice() { var candlePrice=0; var theForm = document.forms["cakeform"]; var includeCandles = theForm.elements["includecandles"]; if(includeCandles.checked==true) { candlePrice=5; } return candlePrice; }

function insciptionPrice() { var inscriptionPrice=0; var theForm = document.forms["cakeform"]; var includeInscription = theForm.elements["includeinscription"]; if(includeInscription.checked==true){ inscriptionPrice=20; } return inscriptionPrice; }

function calculateTotal() { validateDetails(); var cakePrice = getCakeSizePrice() + getFillingPrice() + candlesPrice() + insciptionPrice(); var divobj = document.getElementById('totalPrice'); divobj.style.display='block'; divobj.innerHTML = "Total Price For the Pie $"+cakePrice; }

function hideTotal() { var divobj = document.getElementById('totalPrice'); divobj.style.display='none'; }

function validateDetails() { var isChecked = false; var radioButtons = document.getElementsByName("selectedcake"); for(let i=0; i

if(isChecked == false) { alert("Please select a size!!"); return; }

if(!document.getElementById("name").value) { alert("Please enter a name!!"); return; }

if(!document.getElementById("address").value) { alert("Please enter an address!!"); return; }

if(!document.getElementById("phonenumber").value) { alert("Please enter a phone number!!"); return; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions