Skip to content

Commit

Permalink
Loc name autofills now
Browse files Browse the repository at this point in the history
I'm pretty happy with the shoppingcart UI
  • Loading branch information
arc12012 committed Mar 30, 2017
1 parent af11bb7 commit f75d22c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions WebContent/html/webpages/shoppingCart.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ if(c.getName().equals("ssoNum")) sso = Integer.parseInt(c.getValue());
</div>
<div class="form-group-row">
<label for="">Location Name</label>
<input type="text" onkeyup="forceDropdownCustomLocation" class="form-control" name="locname" style="width: 50%" placeholder="Give your location a name!" required/>
<input type="text" onkeyup="forceDropdownCustomLocation" class="form-control" name="locname" style="width: 50%" placeholder="Give your location a name!" readonly required/>
</div>
<div class="form-group row" style="display: block; align-items: center;margin: 3% auto;">
<div class="col-md-6" style="width:50%">
Expand Down Expand Up @@ -392,17 +392,25 @@ function forceUpdateLocationMetadata() {
for (var i = locations.length - 1; i >= 0; i--) {
if(locations[i].id==selectedLocID) selectedLocation=locations[i];
}
if(selectedLocID!=-1) //-1 is the 'new location' option
if(selectedLocID!=0) //0 is the 'new location' option
{
document.orderForm.locname.value = selectedLocation.name;
document.orderForm.address.value = selectedLocation.address;
document.orderForm.city.value = selectedLocation.town;
document.orderForm.state.value = selectedLocation.state;
document.orderForm.zip.value = selectedLocation.zip;
// if we're force updating metadata, it means we don't want the name to be editable
document.orderForm.locname.readOnly=true;
}
else document.orderForm.locname.readOnly=false; //Should be editable with new location though
}
function forceDropdownCustomLocation() {
$("#dropdown option[value='0']").attr("selected",true);
document.orderForm.location_dropdown.selectedIndex=0;
document.orderForm.locname.value="";
document.orderForm.locname.readOnly=false; //let user edit name since they're making new location
}
function getLocations() {
Expand Down

0 comments on commit f75d22c

Please sign in to comment.