{% assign url = page.full_path | split: '/custom-order?name=' %}
{% assign url = url | join: '' %}
{% assign url = url | split: '%20' %}
{% assign url = url | join: ' ' %}
{% assign counter = 999999 %}
{% if url == '/custom-order' %}
{% assign counter = 1 %}
{% endif %}
{% for product in categories.custom.products limit: counter %}
{% if url == product.name %}
$("[type='color']").spectrum({
flat: true,
preferredFormat: "hex",
showInput: true,
move: function(color) {
$("[type='color']").val(color.toHexString());
$('.colorpreview').css('background-color',color.toHexString());
}
});
var prName = '';
var prColor = '';
var prID = '';
var prRange = '';
var form = document.getElementById('formS');
var submitBtn = document.getElementById('submitBtn');
submitBtn.addEventListener('click', function(e){
e.preventDefault();
prID = document.getElementById('option');
prID = prID.options[prID.selectedIndex].value;
prName = document.getElementById('prName').value;
prColor = document.getElementById('input-color').value;
prRange = document.getElementById('myRange').value;
if(prRange == 1){ prRange = 'Dry'; }
else if(prRange == 2){ prRange = 'Semi dry'; }
else if(prRange == 3){ prRange = 'Normal'; }
else if(prRange == 4){ prRange = 'Semi wet'; }
else if(prRange == 5){ prRange = 'Wet'; }
var msg = "Name: "+document.getElementById('name').value+"<br>"+
"Email: "+document.getElementById('email').value+"<br>"+
"Instructions: "+document.getElementById('inst').value+"<br>"+
"Product Name: "+prName+"<br>"+
"Product Color: "+prColor+"<br>"+
"Product Wetness: "+prRange;
$.ajax({
type: 'POST',
url: 'https://kapuih.000webhostapp.com/upload.php',
data: 'msg='+msg,
}).done(function(res){
form.submit();
});
});
function done1(){
form.submit();
}