Permalink
Browse files

Fixes issue 1: Empty date range fields are not submitted with the form.

  • Loading branch information...
1 parent 15ea9a9 commit 5a38613b58c3bc1996c272ab899c4370acdae036 Rune Kaagaard committed Nov 8, 2011
Showing with 12 additions and 1 deletion.
  1. +12 −1 filtrate/static/filtrate/js/daterangefilter.js
  2. BIN tests/test_project/test_db.sql
@@ -22,8 +22,19 @@
}
});
+ /**
+ * When the submit button is clicked, we disable all the __alt fields so
+ * they wont get submitted. We also disable fields whose alt __alt fields
+ * are empty.
+ */
$('form.filtrate_daterange_form input[type=submit]').click(function() {
- $(this).parent().find('.filtrate_date').attr('disabled', 'disabled');
+ $(this).parent().find('.filtrate_date_hidden').each(function() {
+ var datepicker = $('#' + $(this).attr('id') + '__alt');
+ if (datepicker.val() === "") {
+ $(this).attr('disabled', 'disabled');
+ }
+ datepicker.attr('disabled', 'disabled');
+ });
});
});})(jQuery || django.jQuery, this);
Binary file not shown.

0 comments on commit 5a38613

Please sign in to comment.