capture download link and view the download link

1
0
-1

Greetings,

I have some issue regarding jQuery in Bonitasoft. I called href download link in jQuery code but it is "undefined" when it run on browser. But, if I called the href in console, it displayed the download link.

<script type="text/javascript">
$(document).ready(function()
{
    var attachLeave = function()
    {
        console.log('kucingku comel')
        var leave1 =  $('#leaveType1').find('select').val();
        var btn = $('#Submit1').find('button');
        console.log (leave1);
        if(leave1 == "Medical Leave"){
             btn.attr('disabled', 'disabled');
             btn.attr('style', 'color:black');
        }
        else{
             btn.removeAttr('disabled');
             btn.attr('style', 'color:white');
        }
    }

var attachmentUpload = function()  
{
    console.log('enter attachment validation');
    var UploadEx = $('#File1').find('.bonita_file_upload').val();
    var uploadFile = $('#File1').find('.bonita_download_link');
    var btn = $('#Submit1').find('button');
    uploadFile.attr('href');
    console.log('download-link ' + uploadFile.attr('href'));
    if(uploadFile.attr('href') != "null")
    {
        console.log('Ready to download');
        btn.removeAttr('disabled');
        btn.attr('style', 'color:white');
    }
    else
    {
        console.log("Download is blank");
        btn.attr('disabled', 'disabled');
        btn.attr('style', 'color:black');
    }

}

    console.log('ayam goreng');
    //$('#Submit1').find('button').attr('disabled', 'disabled');
    var leave1 =  $('#leaveType1').find('select');
    leave1.change(attachLeave);
    //attach file or URL to attachment
    var uploadExcuse =  $('#File1').find('.bonita_file_upload');
    uploadExcuse.on('change', attachmentUpload);
});
</script>

I hope anyone here can help me. Thanks

No answers yet.
Notifications