I have a form containing user information and I need to include a ID badge image. This will need to change when new data is loaded into the form.
I have looked at the ‘template’ view example, and have tried to adapt it for my own use. I create the forms in php using the JSON format so for a normal text field everything is needed to be quoted as
{
"id":"frmID",
"name":"frmID",
"view":"text",
"value":"100"
},
This is one of my attempts. The ‘img’ parameter is the one that will change when new data is loaded.
{
"view":"template",
"data":{
"path":"/core/id_photo.php?id=p",
"img":"0",
"width":"120",
"height":"120"
},
"template":function(obj){
return "'<img src="' + obj.path + obj.img +'"/>'";
}
}
How do I quote the “template” function to get it into a JSON format to run out of php?
Or is there an easier way to create an image that responds to data loading?
Many thanks