I’m using the Debut theme and I believe Ajax is enabled on the theme. I’ve added my custom required fields:
<div class="fein-resale">
<p class="cart-attribute__field resalecert idnumbers">
<label for="resale-certificate">Resale Certificate Number *</label>
<input required class="required" id="resale-certificate" type="text" name="attributes[Resale Certificate]" value="{{ cart.attributes["Resale Certificate"] }}">
</p>
<p class="cart-attribute__field fedidn idnumbers">
<label for="federal-tax-id">Federal Tax ID Number *</label>
<input required class="required" id="federal-tax-id" type="text" name="attributes[Federal Tax ID]" value="{{ cart.attributes["Federal Tax ID"] }}">
</p>
<div style="clear:both;"></div>
<p class="required"><small>* required</small></p>
</div>
but I can’t get it to validate. I’m trying to use javascript but don’t think I’m getting it quite right. Could someone help me get the right code possibly?
Here’s what I have but I know it’s incomplete:
$(".template-cart form[action='/cart']").on("submit", function(e){
$(".cart_error").remove();
if(#resale-certificate == ""){
alert("Please enter your Resale Certificate #");
attributes[Resale Certificate].focus();
return false;
}
if(#federal-tax-id == ""){
alert("Please enter your Federal Tax ID #");
attributes[Resale Certificate].focus();
return false;
}
});
Also, I have this at the bottom of the theme.js file under the last line:
$(theme.init);
Is that correct?
Thank you for your time and help!