From fe14180ec5cd975cf77b0d33428c9d835e0d2ddd Mon Sep 17 00:00:00 2001 From: flodef Date: Fri, 14 Nov 2014 22:30:16 +0100 Subject: [PATCH 1/2] Update register.php - Remove unused variable : $cur_item_info - Change .click for .focus : correct a bug when the text doesn't disappear on chrome after changing tab --- application/views/sales/register.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/views/sales/register.php b/application/views/sales/register.php index 4b93040ca..8b3e76ce0 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -86,7 +86,6 @@ else { foreach(array_reverse($cart, true) as $line=>$item) { - $cur_item_info = $this->Item->get_info($item['item_id']); echo form_open("sales/edit_item/$line"); ?> @@ -407,7 +406,7 @@ $(document).ready(function() $(this).attr('value',"lang->line('sales_start_typing_item_name'); ?>"); }); - $('#item,#customer').click(function() + $('#item,#customer').focus(function() { $(this).attr('value',''); }); From ba47d5e4ff3a20911246343d38572ce37a0e57b2 Mon Sep 17 00:00:00 2001 From: flodef Date: Fri, 14 Nov 2014 22:40:36 +0100 Subject: [PATCH 2/2] Update register.php - Correct previous commit when it was impossible to set any value anymore (oooops, I went too quickly on this one) - Use .val instead of .attr("value") because the latter is deprecated --- application/views/sales/register.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/application/views/sales/register.php b/application/views/sales/register.php index 8b3e76ce0..582bbf25a 100644 --- a/application/views/sales/register.php +++ b/application/views/sales/register.php @@ -401,14 +401,17 @@ $(document).ready(function() $('#item').focus(); - $('#item').blur(function() + $('#item').blur(function() { - $(this).attr('value',"lang->line('sales_start_typing_item_name'); ?>"); + $(this).val("lang->line('sales_start_typing_item_name'); ?>"); }); - $('#item,#customer').focus(function() + $('#item, #customer').focus(function() { - $(this).attr('value',''); + if ($(this).val() == "lang->line('sales_start_typing_item_name'); ?>") + { + $(this).val(''); + } }); $("#customer").autocomplete('', @@ -428,7 +431,7 @@ $(document).ready(function() $('#customer').blur(function() { - $(this).attr('value',"lang->line('sales_start_typing_customer_name'); ?>"); + $(this).val("lang->line('sales_start_typing_customer_name'); ?>"); }); $('#comment').keyup(function() @@ -489,7 +492,7 @@ function post_person_form_submit(response) { if(response.success) { - $("#customer").attr("value",response.person_id); + $("#customer").val(response.person_id); $("#select_customer_form").submit(); } }