Tweaked the customer similar JS. Now only fires if 3 chars entered

This commit is contained in:
Karl Cordes 2010-03-16 14:51:08 +11:00
parent 625eb8e42a
commit 150cbc7079

View file

@ -9,37 +9,44 @@
$(function() {
$("#dialog").hide();
$("#customerName").change(function () {
$("#dialog").hide();
$("#dialog").dialog('close'); //Remove any previously opened dialogs
/*If the user has entered 3 or more characters. Check to see if its similar to existing customers. */
$("#customerName").change(function () {
if($("#customerName").val().length >= 3) {
$.post("/customers/similarCustomers", $("#customerName").serialize(), function(data) {
$("#similarCustList").html(data);
});
$("#dialog").dialog({
position: 'right',
width: 400
});
$.post("/customers/similarCustomers", $("#customerName").serialize(), function(data) {
$("#similarCustList").html(data);
});
$("#dialog").dialog({position: 'right', width: 400});
}
}),
}),
$("#CustomerCountryName").autocomplete({
source: "/countries/completeCountry",
minLength: 3,
select: function(event, ui) {
//alert("You selected " + ui.item.value + " ID:"+ ui.item.id);
$("#CustomerCountryId").val(ui.item.id);
$("#CustomerCountryName").autocomplete({
source: "/countries/completeCountry",
minLength: 3,
select: function(event, ui) {
//alert("You selected " + ui.item.value + " ID:"+ ui.item.id);
$("#CustomerCountryId").val(ui.item.id);
if(ui.item.value == 'Australia') {
$("#ABN").show();
}
else {
$("#ABN").hide();
}
}
});
if(ui.item.value == 'Australia') {
$("#ABN").show();
}
else {
$("#ABN").hide();
}
}
});