Disable button when max attachments reached
This commit is contained in:
parent
18ffc0b657
commit
be6659b183
@ -229,9 +229,26 @@ function display_dropzone_field($url, $id = 'filedrop') {
|
|||||||
// Add the database id to the file
|
// Add the database id to the file
|
||||||
file['databaseId'] = response;
|
file['databaseId'] = response;
|
||||||
});
|
});
|
||||||
|
this.on('addedfile', function() {
|
||||||
|
var numberOfFiles = $('#" . $id . " .file-row').length;
|
||||||
|
|
||||||
|
var disabled = false;
|
||||||
|
if (numberOfFiles >= " . $max_files . ") {
|
||||||
|
disabled = true;
|
||||||
|
}
|
||||||
|
$('." . $id . "-button').attr('disabled', disabled);
|
||||||
|
});
|
||||||
this.on('removedfile', function(file) {
|
this.on('removedfile', function(file) {
|
||||||
// Remove the attachment from the database and the filesystem.
|
// Remove the attachment from the database and the filesystem.
|
||||||
removeAttachment(file['databaseId']);
|
removeAttachment(file['databaseId']);
|
||||||
|
|
||||||
|
var numberOfFiles = $('#" . $id . " .file-row').length;
|
||||||
|
|
||||||
|
var disabled = false;
|
||||||
|
if (numberOfFiles >= " . $max_files . ") {
|
||||||
|
disabled = true;
|
||||||
|
}
|
||||||
|
$('." . $id . "-button').attr('disabled', disabled);
|
||||||
});
|
});
|
||||||
this.on('complete', function(file) {
|
this.on('complete', function(file) {
|
||||||
// Stop animating if complete.
|
// Stop animating if complete.
|
||||||
|
@ -990,7 +990,7 @@ function print_add_ticket()
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-default btn-xs fileinput-button"><?php echo $hesklang['add_files']; ?></button><br>
|
<button class="btn btn-default btn-xs fileinput-button filedrop-button"><?php echo $hesklang['add_files']; ?></button><br>
|
||||||
<a href="file_limits.php" target="_blank"
|
<a href="file_limits.php" target="_blank"
|
||||||
onclick="Javascript:hesk_window('file_limits.php',250,500);return false;"><?php echo $hesklang['ful']; ?></a>
|
onclick="Javascript:hesk_window('file_limits.php',250,500);return false;"><?php echo $hesklang['ful']; ?></a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user