[Bps-public-commit] rt-extension-formtools branch, enabled-by, updated. 0.07_03-1-g52ceb22

Ruslan Zakirov ruz at bestpractical.com
Sun May 1 06:55:50 EDT 2011


The branch, enabled-by has been updated
       via  52ceb222f983bf9885a75231cdd0bc99b4d1c15a (commit)
      from  896e094899279bd570e5fee345ded9acda9eecd8 (commit)

Summary of changes:
 html/NoAuth/js/form_tools.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 52ceb222f983bf9885a75231cdd0bc99b4d1c15a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun May 1 14:50:11 2011 +0400

    support other inputs in enabled_by feature
    
    only checkboxes and radios were supported, now text, hidden
    and other inputs work

diff --git a/html/NoAuth/js/form_tools.js b/html/NoAuth/js/form_tools.js
index a150498..92b826a 100644
--- a/html/NoAuth/js/form_tools.js
+++ b/html/NoAuth/js/form_tools.js
@@ -13,9 +13,13 @@ function disable_form_field(disable, selector) {
 function should_disable_form_field( fields, values ) {
     for ( var i = 0; i<fields.length; i++ ) {
         var field = fields[i];
-        var active = jQuery('input:checked:enabled[name="'+ field +'"], input:checked:enabled[name="'+ field +'s"]').filter(function() {
+        var active = jQuery('input:enabled[name="'+ field +'"], input:enabled[name="'+ field +'s"]').filter(function() {
+            var value = this.value;
+            if ( this.type == 'radio' || this.type == 'checkbox' ) {
+                if ( jQuery(this).attr('checked') === undefined ) return 0;
+            }
             for ( var i = 0; i < values[field].length; i++ ) {
-                if ( this.value == values[field][i] ) { return 1 }
+                if ( value == values[field][i] ) { return 1 }
             }
             return 0;
         }).length;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list