Disable "Load Local File" button unless a file is selected.
This commit is contained in:
parent
008c51f352
commit
3b3fcadee8
2 changed files with 11 additions and 1 deletions
|
|
@ -129,6 +129,16 @@ C1PSerialPort.prototype.setBinding = function(c, t, s, e)
|
||||||
if (window.FileReader && window.File && window.FileList && window.Blob ) {
|
if (window.FileReader && window.File && window.FileList && window.Blob ) {
|
||||||
var serial = this;
|
var serial = this;
|
||||||
this.bindings[s] = e;
|
this.bindings[s] = e;
|
||||||
|
|
||||||
|
// Enable "Load Local File" button only if a file is actually selected
|
||||||
|
e.addEventListener('change', function () {
|
||||||
|
var fieldset = e.children[0];
|
||||||
|
var files = fieldset.children[0].files;
|
||||||
|
var submit = fieldset.children[1];
|
||||||
|
|
||||||
|
submit.disabled = (files.length == 0);
|
||||||
|
});
|
||||||
|
|
||||||
e.onsubmit = function (event) {
|
e.onsubmit = function (event) {
|
||||||
var file = event.currentTarget[1].files[0];
|
var file = event.currentTarget[1].files[0];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@
|
||||||
<form class="{$APPCLASS}-{@class}" data-value="{$type},{$binding}">
|
<form class="{$APPCLASS}-{@class}" data-value="{$type},{$binding}">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input type="file"/>
|
<input type="file"/>
|
||||||
<input type="submit" value="Load Local File" />
|
<input type="submit" value="Load Local File" disabled="true"/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue