MDL-26167 lib/form: Altering Javascript so that "disabledIf" will disable the "Choose" button for a filepicker

This commit is contained in:
Aaron Wells 2011-04-12 14:30:13 +12:00
parent 91787c37e1
commit 4b72f9eb78
4 changed files with 22 additions and 2 deletions

View file

@ -198,12 +198,25 @@ M.form.initFormDependencies = function(Y, formid, dependencies) {
*/
_disableElement : function(name, disabled) {
var els = this.elementsByName(name);
var form = this;
els.each(function(){
if (disabled) {
this.setAttribute('disabled', 'disabled');
} else {
this.removeAttribute('disabled');
}
// Extra code to disable a filepicker
if (this.getAttribute('class') == 'filepickerhidden'){
var pickerbuttons = form.elementsByName(name + 'choose');
pickerbuttons.each(function(){
if (disabled){
this.setAttribute('disabled','disabled');
} else {
this.removeAttribute('disabled');
}
});
}
})
},
/**