123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              
<div id="head">
	<h1> Order Form</h1>
	<span id="date"></span>
</div>

<!-- ..............First Panel................. -->
<div class="panel panel-primary">
	<span class="panel-heading">Select a Product</span>
		<div class="panel-body">
			<form action="#" class="form-horizontal" id="productInfo" onsubmit="validateForm()">
				<div class="form-group">
				    <span class="control-label col-sm-2 text-muted small-font">Product:</span>
				    <div class="col-sm-8">
				      	<select class="form-control" id="product" name="selection" onchange="calculateTotal()" required>
						    <option value="product1">Caldwell Guides</option>
						    <option value="product2">Caldwell Guides With Map</option>
						</select>
				    </div>
			  </div>
			  <div class="form-group">
				    <span class="control-label col-sm-2 text-muted small-font">Quantity: </span>
				    <div class="col-sm-8">
				      	<select class="form-control" id="quantity" onchange="calculateTotal()" required>
						    <option value="one">1</option>
						    <option value="two">2</option>
						    <option value="three">3</option>
						    <option value="four">4</option>
						    <option value="five">5</option>
						</select>
				    </div>

				    <div class="col-sm-2">
				    	<input type="text" class="form-control" id="productTotal" readonly />
				    </div>
			  </div>

			  <div class="form-group">
			  		<span class="control-label col-sm-2 text-muted small-font">NJ Tax (6%) </span>
			  		<div class="col-sm-8">
				    </div>
				    <div class="col-sm-2">
				    	<input type="text" class="form-control" id="njTax" readonly />
				    </div>
			  </div>

			  <div class="form-group">
			  		<span class="control-label col-sm-2 text-muted small-font">Shipping: </span>
			  		<div class="radio col-sm-8" onclick="calculateTotal()" id="radioButton">
						<div class="radio">
							<label><input type="radio" name="optradio" value="standard">Standard (3-5 days): $7.95</label>
						</div>
						<div class="radio">
							<label><input type="radio" name="optradio" value="express">Express (2 days): $9.95</label>
						</div>
						<div class="radio">
							<label><input type="radio" name="optradio" value="nextDay">Next Day: $12.95</label>
						</div>
					</div>
					<div class="col-sm-2" >
						<input type="text" class="form-control" id="shipping" readonly/>
					</div>
			  </div>

			  <div class="form-group">
				  <div class="col-sm-10">
				  		<span class="control-label col-sm-2 text-muted small-font">Total </span>
				  </div>
				  <div class="col-sm-2" >
				  		<input type="text" class="form-control" id="total" readonly/>
				  </div>

			  </div>

			</form>
		</div>
</div>


<!-- .......................Second Panel......................... -->
<div class="panel panel-primary">
	<span class="panel-heading">Shipping Address</span>
		<div class="panel-body">
			<form action="#" class="form-horizontal" id="shippingInfo" onsubmit="validateForm()">
				<div class="form-group">
				    <span class="control-label col-sm-2 text-muted small-font">Name</span>
				    <div class="col-sm-8">
				      <input type="text" class="form-control" id="shipping_name" placeholder="Enter shipping Address" required />
				    </div>
			  	</div>

			  	<div class="form-group">
				    <span class="control-label col-sm-2 text-muted small-font">Street: </span>
				    <div class="col-sm-8" >
				      <textarea class="form-control" rows="5" id="shipping_street" required></textarea>
				    </div>
				    <div class="col-sm-2"></div>
			  	</div>

			  	<div class="form-group">
				    <span class="control-label col-sm-1 text-muted small-font">City:</span>
				    <div class="col-sm-3" >
				      <input type="text" class="form-control" id="shipping_city" required/>
				    </div>
				    <span class="control-label col-sm-1 text-muted small-font">State:</span>
				    <div class="col-sm-3" >
				      <select class="form-control" id="shipping_state">
														<option>AL<option>AK<option>AZ<option>AR<option>CA<option>CO<option>CT<option>DE<option>DC
															<option>FL<option>GA<option>HI<option>ID<option>IL<option>IN<option>IA<option>KS<option>KY
																<option>LA<option>ME<option>MD<option>MA<option>MI<option>MN<option>MS<option>MO<option>MT
																	<option>NE<option>NV<option>NH<option>NJ<option>NM<option>NY<option>NC<option>ND<option>OH
																		<option>OK<option>OR<option>PA<option>RI<option>SC<option>SD<option>TN<option>TX<option>UT
																			<option>VT<option>VA<option>WA<option>WV<option>WI<option>WY

																			</select>
				    </div>
				    <span class="control-label col-sm-1 text-muted small-font">Zip:</span>
				    <div class="col-sm-3" >
				      <input type="text" class="form-control" id="shipping_zip" required />
				    </div>
			  	</div>

			</form>
		</div>
</div>

<!-- .......................Third Panel......................... -->
<div class="panel panel-primary">
	<span class="panel-heading">Billing Address</span>
		<div class="panel-body">
			<form action="#" class="form-horizontal" id="billingInfo" onsubmit="validateForm()" >

			<div class="form-group">

				<div class="col-sm-2"></div>

				<div class="checkbox col-sm-4">
					<label><input type="checkbox" id="sameAdd" onclick="sameAddress(this.checked);">Same as Shipping Address</label>
				</div>

				<div class="checkbox col-sm-4">
					<label><input type="checkbox" name="chargeCredit">Charge My Credit Card</label>
				</div>

			  </div>

				<div class="form-group">
				    <span class="control-label col-sm-2 text-muted small-font">Name</span>
				    <div class="col-sm-8" >
				      <input type="text" class="form-control" id="billing_name" placeholder="Enter Billing Address" required/>
				    </div>
			  	</div>

			  	<div class="form-group">
				    <span class="control-label col-sm-2 text-muted small-font">Street: </span>
				    <div class="col-sm-8" >
				      <textarea class="form-control" rows="5" id="billing_street" required></textarea>
				    </div>
				    <div class="col-sm-2"></div>
			  	</div>

			  	<div class="form-group">
				    <span class="control-label col-sm-1 text-muted small-font">City:</span>
				    <div class="col-sm-3" >
				      <input type="text" class="form-control" id="billing_city" required />
				    </div>
				    <span class="control-label col-sm-1 text-muted small-font">State:</span>
				    <div class="col-sm-3" >
				      <select class="form-control" id="billing_state">
														<option>AL<option>AK<option>AZ<option>AR<option>CA<option>CO<option>CT<option>DE<option>DC
															<option>FL<option>GA<option>HI<option>ID<option>IL<option>IN<option>IA<option>KS<option>KY
																<option>LA<option>ME<option>MD<option>MA<option>MI<option>MN<option>MS<option>MO<option>MT
																	<option>NE<option>NV<option>NH<option>NJ<option>NM<option>NY<option>NC<option>ND<option>OH
																		<option>OK<option>OR<option>PA<option>RI<option>SC<option>SD<option>TN<option>TX<option>UT
																			<option>VT<option>VA<option>WA<option>WV<option>WI<option>WY

																			</select>
				    </div>
				    <span class="control-label col-sm-1 text-muted small-font">Zip:</span>
				    <div class="col-sm-3" >
				      <input type="text" class="form-control" id="billing_zip" required />
				    </div>
			  	</div>

			</form>
		</div>
</div>



<!--..................................Fourth Panel............................. -->
<div class="panel panel-primary">
	<span class="panel-heading">Credit Card Information</span>
		<div class="panel-body">
	     	<form action="#" class="credit-card-div" id="creditInfo" onsubmit="validateForm()">

			    <div class="row ">
			        <div class="col-md-12">
			        	<span class="help-block text-muted small-font" >Card Number</span>
			            <input type="text" class="form-control" placeholder="Enter Card Number" required />
			        </div>
			    </div>

			    <div class="row small-font">
			        <div class="col-md-3">
			            <label><input type="radio" name="optradio">VISA</label>
			        </div>
			        <div class="col-md-3">
			            <label><input type="radio" name="optradio">MASTERCARD</label>
			        </div>
			        <div class="col-md-3">
			            <label><input type="radio" name="optradio">AMERICAN EXPRESS</label>
			        </div>
			        <div class="col-md-3">
			            <label><input type="radio" name="optradio">DISCOVER</label>
			        </div>
			    </div>

			    <div class="row ">
			        <div class="col-md-12 pad-adjust">
			        	<span class="help-block text-muted small-font">Name</span>
			            <input type="text" class="form-control" placeholder="Name On The Card" required />
			        </div>
			    </div>

			     <div class="row ">
			        <div class="col-md-3 col-sm-3 col-xs-3">
			            <span class="help-block text-muted small-font" > Expiry Month</span>
			            <input type="text" class="form-control" placeholder="MM" required />
			        </div>

			        <div class="col-md-3 col-sm-3 col-xs-3">
			            <span class="help-block text-muted small-font" >  Expiry Year</span>
			            <input type="text" class="form-control" placeholder="YY" required />
			        </div>

			        <div class="col-md-3 col-sm-3 col-xs-3">
			            <span class="help-block text-muted small-font" >  CCV</span>
			            <input type="text" class="form-control" placeholder="CCV" required />
			        </div>
			    </div>
	     </form>
	   </div>
</div>

<!-- .......................Footer................................ -->

	<div class="row ">
		<div class="col-md-6 col-sm-6 col-xs-6 pad-adjust">
		    <input type="submit"  class="btn btn-danger" value="CANCEL ORDER" onclick="return resetForm()" />
		</div>
		<div class="col-md-6 col-sm-6 col-xs-6 pad-adjust">
		    <input type="submit"  class="btn btn-warning btn-block" value="Submit Order" onclick="return validateForm()" />
		</div>
	</div>

            
          
!
            
              body {
  position: relative;
  margin: auto;
  display: block;
  
  width: 600px;
  height: 600px;
 
}

#head {
	margin-bottom: 3%;
	text-align: center;
	color: white;
	background: #337AB7;
	border-radius: 25px;
}


.credit-card-div .small-font { font-size:9px; }
.credit-card-div .pad-adjust { padding-top:10px; }
            
          
!
            
              //Indexing Form
var theForm = document.forms["productInfo"];
var shippingForm = document.forms["shippingInfo"];
var billingForm = document.forms["billingInfo"];
var creditForm = document.forms["creditInfo"];

//Getting Price from the slected roeduct
var productPrice = new Array();
productPrice["product1"] = 30;
productPrice["product2"] = 50;

function getProductPrice() {
	var price = 0;
	var selectedProduct = theForm.elements["product"];
	price = productPrice[selectedProduct.value];
	return price;
}

//Getting quantity
var quantityArray = new Array();
quantityArray["one"] = 1;
quantityArray["two"] = 2;
quantityArray["three"] = 3;
quantityArray["four"] = 4;
quantityArray["five"] = 5;

function getquantity() {
	var quantityCount = 1;
	var selectedQuantity = theForm.elements["quantity"];
	quantityCount = quantityArray[selectedQuantity.value];
	return quantityCount;
}

//Calculating Shipping Cost
var shippingArray = new Array();
shippingArray["standard"] = 7.95;
shippingArray["express"] = 9.95;
shippingArray["nextDay"] = 12.95;

function getShippingPrice() {
	var shippingPrice = 0;
	var selectedShipping = theForm.elements["optradio"];
	for (var i = 0; i < selectedShipping.length; i++) {
		if (selectedShipping[i].checked) {
			shippingPrice = shippingArray[selectedShipping[i].value];
			break;
		}
	}
	return shippingPrice;
}

function calculateTotal() {
	var price = getProductPrice() *  getquantity();
	var tax = price * 0.06
	var shipping = getShippingPrice();
	var total = price+tax+shipping;
	document.getElementById('productTotal').value = "$" + price
	document.getElementById('njTax').value = "$" + tax;
	document.getElementById('shipping').value = "$" + shipping;
	document.getElementById('total').value = "$" + total;
	}

// Function for making billing address and shipping address same
function sameAddress(checked) {
	if (checked) {
		document.getElementById('billing_name').value = document.getElementById('shipping_name').value;
		document.getElementById('billing_street').value = document.getElementById('shipping_street').value;
		document.getElementById('billing_city').value = document.getElementById('shipping_city').value;
		document.getElementById('billing_state').value = document.getElementById('shipping_state').value;
		document.getElementById('billing_zip').value = document.getElementById('shipping_zip').value;
		}

	else {
		document.getElementById('billing_name').value = "";
		document.getElementById('billing_street').value = "";
		document.getElementById('billing_city').value = "";
		document.getElementById('billing_state').value = "";
		document.getElementById('billing_zip').value = "";
	}
}

//Reseting Form
function resetForm() {
	document.getElementById('productInfo').reset();
	document.getElementById('shippingInfo').reset();
	document.getElementById('billingInfo').reset();
	document.getElementById('creditInfo').reset();
}

// validating and Submitting Form
 function validateForm() {
 	var option = theForm.elements["optradio"];
	 if (option.checked) {
	 	alert("Good Job");
	 }
 }

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console