Skip to content

Business intelligence made simple

Submit form when all values are entered

Andrew Kaneb482e66e7542
diff --git a/app/views/blazer/queries/show.html.erb b/app/views/blazer/queries/show.html.erb
index 0f752724..945c1745 100644
--- a/app/views/blazer/queries/show.html.erb
+++ b/app/views/blazer/queries/show.html.erb
@@ -124,15 +124,23 @@
$("#results").html(data);
$("#results table").stupidtable().stickyTableHeaders({fixedOffset: 60});
});
-
- $(".form-inline input, .form-inline select").change( function () {
- if ($(this).val() != "") {
- $(this).closest("form").submit();
- }
- });
</script>
<% end %>
<script>
hljs.initHighlightingOnLoad();
+
+ $(".form-inline input, .form-inline select").change( function () {
+ // see if all value are entered
+ var $form = $(this).closest("form");
+ var completed = true;
+ $form.find("input[name], select").each( function() {
+ if ($(this).val() == "") {
+ completed = false;
+ }
+ });
+ if (completed) {
+ $form.submit();
+ }
+ });
</script>