[Bps-public-commit] rt-extension-formtools branch, master, updated. 0.11_01-2-gfde1e8a
Ruslan Zakirov
ruz at bestpractical.com
Sat Oct 20 19:11:04 EDT 2012
The branch, master has been updated
via fde1e8a83e6adefe996efc912c89d5aac2f94012 (commit)
from 91792189fdaa3d82e570f28f20a923596c79fe85 (commit)
Summary of changes:
html/NoAuth/js/form_tools.js | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
- Log -----------------------------------------------------------------
commit fde1e8a83e6adefe996efc912c89d5aac2f94012
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Sun Oct 21 03:09:44 2012 +0400
new features in disable_form_field
make it possible for selector to point directly at
a form field
make it possible to disable particular options
diff --git a/html/NoAuth/js/form_tools.js b/html/NoAuth/js/form_tools.js
index 0b35463..619a839 100644
--- a/html/NoAuth/js/form_tools.js
+++ b/html/NoAuth/js/form_tools.js
@@ -1,12 +1,19 @@
function disable_form_field(disable, selector) {
if ( disable ) {
- jQuery(selector).addClass('hidden').find('input,select,textarea,button').attr('disabled', 'disabled');
- }
- else {
+ jQuery(selector).addClass('hidden')
+ .find('input,select,textarea,button')
+ .add(jQuery(selector).filter('input,select,textarea,button,option'))
+ .attr('disabled', 'disabled')
+ .filter('option').attr('selected', false);
+ } else {
jQuery(selector).removeClass('hidden');
- jQuery(selector).find('input,select,textarea,button').filter( function() {
- return jQuery(this).closest('.hidden').length == 0
- } ).removeAttr('disabled');
+ jQuery(selector)
+ .find('input,select,textarea,button,option')
+ .add(jQuery(selector).filter('input,select,textarea,button,option'))
+ .filter( function() {
+ return jQuery(this).closest('.hidden').length == 0
+ } )
+ .removeAttr('disabled');
}
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list