attaching files

Questions related to using nuBuilder Forte.

attaching files

Postby dmier » Wed May 01, 2019 11:19 pm

Im having some troubles attaching files to a existing form, I have attached both images, one from the object form and phpadmin,

The problem is that when I save the file, the field goes blank, I already check phpadmin and its saved, what I want is display the image or at least a link to see the file
Attachments
Screen Shot 2019-05-01 at 8.46.00 AM.png
Screen Shot 2019-05-01 at 8.46.00 AM.png (38.87 KiB) Viewed 506 times
Screen Shot 2019-05-01 at 8.43.16 AM.png
Screen Shot 2019-05-01 at 8.43.16 AM.png (48.78 KiB) Viewed 506 times
dmier
 
Posts: 16
Joined: Fri Apr 12, 2019 4:24 am

Re: attaching files

Postby kev1n » Thu May 02, 2019 4:59 pm

Check out the JavaScript code of the "Stored Files" form.
kev1n
 
Posts: 358
Joined: Mon Oct 15, 2018 2:13 am

Re: attaching files

Postby dmier » Thu May 02, 2019 9:55 pm

Code: Select all
function nuShowFile(){
   
    var j   = $('#sfi_json').val();
   
    nuEmbedObject(j, 'view_image');
       
}


this one?

what about the input image? can it be done with that one? I can click on on it but It will not work

Or a Link to the attached file
Attachments
Screen Shot 2019-05-02 at 7.37.28 AM.png
Screen Shot 2019-05-02 at 7.37.28 AM.png (16.1 KiB) Viewed 493 times
dmier
 
Posts: 16
Joined: Fri Apr 12, 2019 4:24 am

Re: attaching files

Postby kev1n » Fri May 03, 2019 3:59 pm

This is the relevant code of the "Stored Files" form:

Code: Select all
if(nuFormType() == 'edit'){
    nuShowFile();
}


function nuBeforeSave(){

    var f   = $('#sfi_json_file').val();
   
    if(f != ''){
       
        $('#sfi_json')
        .val(f)
        .change();
       
    }
   
    return true;

}

function nuShowFile(){
   
    var j   = $('#sfi_json').val();
       debugger;
   if(j == ''){return;}
   
   var ob   = JSON.parse(j)
   var ty   = ob.type;
   var ur   = atob(ob.file);
    var x   = document.createElement("EMBED");
   
    x.setAttribute("type", ty);
    x.setAttribute("src", ur);
//    x.setAttribute("width", "300px");
//    x.setAttribute("height", "300px");

    $('#view_image').html('');
    document.getElementById('view_image').appendChild(x);
       
}



You need two objects:

1. Object to upload a file:
Type Input, Input Type File
ID: sfi_json_file

2. Object to display the image:
Type HTML
ID: view_image

with HTML:
<img
id="theview"
style="border:grey 1px solid;"
>
kev1n
 
Posts: 358
Joined: Mon Oct 15, 2018 2:13 am

Re: attaching files

Postby dmier » Sat May 04, 2019 12:37 am

I'm kind of lost, still not showing the image, I have attached pics, where is the javascript supposed to be located?
Attachments
Screen Shot 2019-05-03 at 10.02.38 AM.png
Screen Shot 2019-05-03 at 10.02.38 AM.png (16.86 KiB) Viewed 480 times
Screen Shot 2019-05-03 at 10.03.29 AM.png
Screen Shot 2019-05-03 at 10.03.29 AM.png (59.06 KiB) Viewed 480 times
Screen Shot 2019-05-03 at 10.04.40 AM.png
Screen Shot 2019-05-03 at 10.04.40 AM.png (26.6 KiB) Viewed 480 times
dmier
 
Posts: 16
Joined: Fri Apr 12, 2019 4:24 am

Re: attaching files

Postby dmier » Sat May 04, 2019 1:04 am

there is an extra object in the file upload form, im really lost, need help.
Attachments
Screen Shot 2019-05-03 at 10.33.30 AM.png
Screen Shot 2019-05-03 at 10.33.30 AM.png (30.75 KiB) Viewed 477 times
dmier
 
Posts: 16
Joined: Fri Apr 12, 2019 4:24 am

Re: attaching files

Postby kev1n » Sat May 04, 2019 1:29 am

Is the image displayed after saving?
kev1n
 
Posts: 358
Joined: Mon Oct 15, 2018 2:13 am

Re: attaching files

Postby dmier » Sat May 04, 2019 1:30 am

No, its not displaying the image
Attachments
Screen Shot 2019-05-03 at 11.09.16 AM.png
Screen Shot 2019-05-03 at 11.09.16 AM.png (37.08 KiB) Viewed 472 times
Screen Shot 2019-05-03 at 11.08.16 AM.png
Screen Shot 2019-05-03 at 11.08.16 AM.png (15.7 KiB) Viewed 472 times
dmier
 
Posts: 16
Joined: Fri Apr 12, 2019 4:24 am

Re: attaching files

Postby dmier » Sat May 04, 2019 1:45 am

I would be so happy, even if its just a display link.
dmier
 
Posts: 16
Joined: Fri Apr 12, 2019 4:24 am

Re: attaching files

Postby kev1n » Sat May 04, 2019 2:11 am

Just a moment, please. I'll see if this works for me....
kev1n
 
Posts: 358
Joined: Mon Oct 15, 2018 2:13 am

Next

Return to General