gitana / alpaca

Alpaca provides the easiest way to generate interactive HTML5 forms for web and mobile applications. It uses JSON Schema and simple Handlebars templates to generate great looking, dynamic user interfaces on top of Twitter Bootstrap, jQuery UI, jQuery Mobile and HTML5.
http://www.alpacajs.org
Other
1.29k stars 371 forks source link

Unable to set uploaded images in postRender #772

Closed britisharmy closed 1 year ago

britisharmy commented 1 year ago

I have this object

{
    "files": [{
        "name": "713311.png",
        "size": false,
        "deleteUrl": "https://example.com/file_uploads/uploads/713311.png",
        "deleteType": "DELETE"
    }, {
        "name": "1008112.png",
        "size": false,
        "deleteUrl": "https://example.com/file_uploads/uploads/1008112.png",
        "deleteType": "DELETE"
    }, {
        "name": "1048333.png",
        "size": false,
        "deleteUrl": "https://example.com/file_uploads/uploads/1048333.png",
        "deleteType": "DELETE"
    }, {
        "name": "1768201.png",
        "size": false,
        "deleteUrl": "https://example.com/file_uploads/uploads/1768201.png",
        "deleteType": "DELETE"
    }],
    "name": "John Matrix",
    "age": 40,
    "images": "no images",
    "ice": "Mint",
    "condition": "Refurbished",
    "array_data": [{
        "flavor": "strawberry",
        "topping": "nuts"
    }, {
        "flavor": "chocolate",
        "topping": "raisin"
    }],
    "description_required": "Y",
    "printer_type": "Laser Jet",
    "description": "<p><strong>This is a very good description</strong></p>",
    "color": "Blue"
}

that i have posted from my form and saved it in my remote server. I then obtain the object using ajax and try and display the images

in postRender

"postRender": function() {
$.get("http://localhost:8000/data_routes/fetch_edit_data", function(response){
form.data = response;
    console.log('Mounted Lifecycle Method', response );
    console.log('After Edit Data Inserted', form.data );
    let remoteData = JSON.parse(response);
    console.log('Remote Data', typeof response );
    //Object.assign(form.data, remoteData);
    $('#form').alpaca().setValue(remoteData);
  });

}

Every other data is displayed but the images are not. I am using image upload functionality http://www.alpacajs.org/docs/fields/upload.html

Why are my images not being displayed?