Changed find customer to a dialog with button

This commit is contained in:
Karl Cordes 2010-03-30 10:55:12 +11:00
parent d6c6dbc866
commit b474ecd076
2 changed files with 33 additions and 14 deletions

View file

@ -7,13 +7,16 @@
echo $html->image('system-search.png');
echo '</h2>';
echo $form->input('Customer.name', array('Label'=>'Customer Name', 'id'=>'customerName', 'div'=>'ui-widget'));
echo $form->input('Customer.name', array('Label'=>'Customer Name', 'id'=>'customerName'));
//echo $form->input('Customer.id', array('type'=>'hidden'));
//echo $form->end('Find');
?>
<div class ="ui-widget">
<button id="findButton">Find Customer</button>
</div>
</div>

View file

@ -8,30 +8,46 @@
$(function() {
$("#dialog").hide();
$("#dialog").hide();
/*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: 'center',
width: 400
});
findCustomer();
}
})
});
$("#findButton").button().click(function() {
findCustomer();
return false;
});
}
);
function findCustomer() {
$.post("/customers/similarCustomers", $("#customerName").serialize(), function(data) {
$("#similarCustList").html(data);
});
$("#dialog").dialog({
position: 'center',
width: 400
});
}