- Home /
- Connectors, Interconnects /
- /
- EHF-125-01-F D-SM-LC
'); } // Validate Quantity Needed (Must be greater than 0) var quantity = $("#txtQuantityNeeded").val().trim(); if (quantity === "" || isNaN(quantity) || quantity <= 0) { isValid = false; $("#txtQuantityNeeded").after('
Enter a valid quantity greater than 0.
'); } // Validate Email var txtEmail = $("#txtEmail").val().trim(); var emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; if (txtEmail === "" || !emailPattern.test(txtEmail)) { isValid = false; $("#txtEmail").after('
Enter a valid email address.
'); } // Validate Phone (Optional: Only allow digits) var phone = $("#txtPhone").val().trim(); if (phone === "") { isValid = false; $("#txtPhone").after('
Enter a valid phone number.
'); } // Validate Delivery Address var deliveryAddress = $("#txtDeliveryAddress").val().trim(); if (deliveryAddress === "") { isValid = false; $("#txtDeliveryAddress").after('
Delivery address cannot be empty.
'); } // Validate Expected Delivery Date (Must be in the future) var deliveryDate = $("#txtExpectedDeliveryDate").val(); var today = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format if (deliveryDate === "" || deliveryDate < today) { isValid = false; $("#txtExpectedDeliveryDate").after('
Select a future delivery date.
'); } // If validation fails, stop the process if (!isValid) return; $("#add-AskForEstimation-popup-window .modal-header").removeAttr("style"); $("#add-AskForEstimation-popup-window .modal-title").removeAttr("style"); $("#add-AskForEstimation-popup-window .modal-title").html("Ask for an Estimation"); // Get the selected values var productId = $("#ProductId").val(); // Construct data object var data = { ProductId: 1329632, PartNumber: $("#txtPartNumber").val(), QuantityNeeded: $("#txtQuantityNeeded").val(), Email: $("#txtEmail").val(), Phone: $("#txtPhone").val(), DeliveryAddress: $("#txtDeliveryAddress").val(), ExpectedDeliveryDate: $("#txtExpectedDeliveryDate").val() }; // Make AJAX request $.ajax({ url: '/Product/AddToAskForEstimation', type: 'POST', data: data, success: function (response) { // Handle success response if (response.Success) { //$("#AskForEstimation-success-content").show(); //CloseAskForEstimationPopup(); // Clear the form fields after success $("#txtQuantityNeeded").val(''); $("#txtEmail").val(''); $("#txtPhone").val(''); $("#txtDeliveryAddress").val(''); $("#txtExpectedDeliveryDate").val(''); $("#AskForEstimation-success-content").show(); //$("#successMessageModal").modal('show').appendTo('body'); } else { CloseAskForEstimationPopup(); showpopup(response.Message); // Display error message } }, error: function () { showpopup("An error occurred while processing the request."); // Handle error } }); }); let isAddingQuickQuote = false; $("#send-quick-qoute").click(function () { var isValid = true; // Clear previous error messages $(".error-message").remove(); // Validate Email var txtEmail = $("#txtEmail_RFQ").val().trim(); var emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; if (txtEmail === "" || !emailPattern.test(txtEmail)) { isValid = false; $("#txtEmail_RFQ").after('
Enter a valid email address.
'); } // Validate Phone (Optional: Only allow digits) var phone = $("#txtPhoneNumber_RFQ").val().trim(); if (phone === "") { isValid = false; $("#txtPhoneNumber_RFQ").after('
Enter a valid phone number.
'); } // Validate PartNumber (Must be required) var partNumber = $("#txtPartNumber_RFQ").val().trim(); if (partNumber === "") { isValid = false; $("#txtPartNumber_RFQ").after('
Part number cannot be empty.
'); } //// Validate Name (Must be required) //var name = $("#txtName_RFQ").val().trim(); //if (name === "") { // isValid = false; // $("#txtName_RFQ").after('
Name cannot be empty.
'); //} //// Validate Quantity Needed (Must be greater than 0) //var quantity = $("#txtQuantity_RFQ").val().trim(); //if (quantity === "" || isNaN(quantity)) { // isValid = false; // $("#txtQuantity_RFQ").after('
Enter a valid quantity greater than 0.
'); //} //// Validate Quantity Needed (Must be greater than 0) //var targetPrice = $("#txtTargetPrice_RFQ").val().trim(); //if (targetPrice === "" || isNaN(targetPrice)) { // isValid = false; // $("#txtTargetPrice_RFQ").after('
Enter a valid price greater than 0.
'); //} // If validation fails, stop the process if (!isValid) return; // Construct data object var data = { ProductId: 1329632, PartNumber: $("#txtPartNumber_RFQ").val(), CustomerName: $("#txtName_RFQ").val(), CustomerEmail: $("#txtEmail_RFQ").val(), CustomerPhone: $("#txtPhoneNumber_RFQ").val(), Quantity: $("#txtQuantity_RFQ").val(), TargetPrice: $("#txtTargetPrice_RFQ").val(), Manufacturer: $("#txtManufacturer_RFQ").val(), }; // Make AJAX request if (isAddingQuickQuote) return; isAddingQuickQuote = true; $.ajax({ url: '/Product/AddToQuickQoute', type: 'POST', data: data, success: function (response) { // Handle success response if (response.success) { // Clear the form fields after success $("#txtPartNumber_RFQ").val(''); $("#txtName_RFQ").val(''); $("#txtQuantity_RFQ").val(''); $("#txtEmail_RFQ").val(''); $("#txtPhoneNumber_RFQ").val(''); $("#txtTargetPrice_RFQ").val(''); $("#txtManufacturer_RFQ").val(''); $("#quick-quote-success-content").show(); } else { $(".quickQuote").css("display", "none"); showpopup(response.Message); // Display error message } }, complete: function () { isAddingQuickQuote = false; }, error: function () { showpopup("An error occurred while processing the request."); // Handle error } });}); //$(document).ready(function () { // $(".full-description .content").addClass('short') // $("#toggle").click(function () { // var elem = $("#toggle").text(); // if (elem == "Read More") { // $("#toggle").text("Read Less"); // $(".full-description .content").removeClass('short') // } else { // $("#toggle").text("Read More"); // $(".full-description .content").addClass('short') // } // }); //});