From 4b2a9bac39a52620e75989c58b346c46037f1d32 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 30 Jun 2010 23:31:12 +0200 Subject: [PATCH] apply regex on column values on enter Before we submited form, which is wrong --- templates/all_checkboxes.html.ep | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/templates/all_checkboxes.html.ep b/templates/all_checkboxes.html.ep index 7e854b2..3e5a6f9 100644 --- a/templates/all_checkboxes.html.ep +++ b/templates/all_checkboxes.html.ep @@ -67,7 +67,10 @@ $('a#excluded').click( function(){ update_checked_count(1); }); -$('input[name=filter_regex]').focusout( function(e) { + +// regex for column names + +var apply_regex = function(e) { console.debug( this, e ); var r = new RegExp( this.value ,'i'); var included = 0; @@ -84,8 +87,23 @@ $('input[name=filter_regex]').focusout( function(e) { $('a#included').text(included).show(); $('a#excluded').text(excluded).show(); + return false; +}; + +$('input[name=filter_regex]') +.focusout( apply_regex ) +.keypress( function(e) { + // disable enter + var code = e.keyCode ? e.keyCode : e.which; + //console.debug('key code',code); + if ( code == 13 ) { + return apply_regex(e); + } else { + return true; + } }); + update_checked_count(1); }); // document.ready -- 2.20.1