From b474ecd0769b1be86c75088a8fbf9fc2b2c0cb02 Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Tue, 30 Mar 2010 10:55:12 +1100 Subject: [PATCH] Changed find customer to a dialog with button --- views/customers/find.ctp | 5 ++++- webroot/js/findcustomer.js | 42 ++++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/views/customers/find.ctp b/views/customers/find.ctp index e43cb9bb..4a0146f8 100755 --- a/views/customers/find.ctp +++ b/views/customers/find.ctp @@ -7,13 +7,16 @@ echo $html->image('system-search.png'); echo ''; - 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'); ?> +
+ +
diff --git a/webroot/js/findcustomer.js b/webroot/js/findcustomer.js index 473d48fb..1c5a71cb 100644 --- a/webroot/js/findcustomer.js +++ b/webroot/js/findcustomer.js @@ -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 + }); + +}