Skip to content

Commit

Permalink
Added update() method to image element JS
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesegrits committed Apr 28, 2014
1 parent df59c0d commit 669618c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/fabrik_element/image/image-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions plugins/fabrik_element/image/image.js
Expand Up @@ -109,5 +109,24 @@ var FbImage = new Class({

getValue : function () {
return this.folderlist.join('/') + '/' + this.selectedImage;// this.hiddenField.value;
},

update : function (val) {
if (!this.hiddenField) {
var el = this.element.getParent('.fabrikElement');
this.hiddenField = el.getElement('.folderpath');
}
if (this.hiddenField) {
this.hiddenField.value = val;
}
if (val !== '') {
this.image.src = Fabrik.liveSite + '/' + val;
this.image.alt = val;
}
else {
this.image.src = '';
this.image.alt = '';
}
}

});

0 comments on commit 669618c

Please sign in to comment.