Skip to content
Browse files

support readonly fields in enabled-by feature

  • Loading branch information...
1 parent bc8eca9 commit 9d20423fffe0c6efa6ec0efc3ac47ff221908cf1 @ruz ruz committed May 2, 2011
Showing with 11 additions and 3 deletions.
  1. +11 −3 html/NoAuth/js/form_tools.js
View
14 html/NoAuth/js/form_tools.js
@@ -13,10 +13,18 @@ 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:enabled[name="'+ field +'"], input:enabled[name="'+ field +'s"]').filter(function() {
- var value = this.value;
- if ( this.type == 'radio' || this.type == 'checkbox' ) {
+ var selector = 'input:enabled[name="'+ field +'"]'
+ +', input:enabled[name="'+ field +'s"]'
+ +', span.readonly[name="'+ field +'"]'
+ +', li.readonly[name="'+ field +'"]'
+ ;
+ var active = jQuery( selector ).filter(function() {
+ var value;
+ if ( this.tagName == 'SPAN' || this.tagName == 'LI' ) {
+ value = jQuery(this).text();
+ } else if ( this.type == 'radio' || this.type == 'checkbox' ) {
if ( !jQuery(this).is(':checked') ) return 0;
+ value = this.value;
}
for ( var i = 0; i < values[field].length; i++ ) {
if ( value == values[field][i] ) { return 1 }

0 comments on commit 9d20423

Please sign in to comment.
Something went wrong with that request. Please try again.