Fixes form reset

This commit is contained in:
nikolark committed 2012-01-07 04:35:24 +01:00
1 parent 135fe821e1
commit 822fc058c8
1 file changed
+8 -7
+8 -7
View File
@@ -1,13 +1,15 @@
$(document).ready(function() { $(document).ready(function() {
/* Customer selection */ function enable_all_customers() {
$("li.customer").click( function() {
/* Enable all buttons */
$("li.customer").each(function(i) { $("li.customer").each(function(i) {
$(this).removeClass("selected"); $(this).removeClass("selected");
}); });
}
/* Customer selection */
$("li.customer").click( function() {
enable_all_customers();
/* Disable the customer button just clicked */ /* Disable the customer button just clicked */
$(this).addClass("selected"); $(this).addClass("selected");
/* Update the form */ /* Update the field */
$("input[name=customer]").val($(this).children("span.name").text()); $("input[name=customer]").val($(this).children("span.name").text());
}); });
/* Product amount controls */ /* Product amount controls */
@@ -16,11 +18,10 @@ $(document).ready(function() {
var qty = Number(form_field.val()) + 1; var qty = Number(form_field.val()) + 1;
form_field.val(qty); form_field.val(qty);
}); });
/* Also reset the hidden customer fields */ /* Form reset */
$("input[type=reset]").click( function() { $("input[type=reset]").click( function() {
$("input[name=customer]").val(""); $("input[name=customer]").val("");
enable_all_customers();
}); });
/* TODO: keyboard shortcuts */
}); });