The AppGini Blog
A few tips and tricks to make your coding life a tiny bit better.

Programmatically change the value of an image field in the detail view

In the detail view, if you have some ajax request running in the background that should update your detail view form (or if you do this in the tablename_dv hook ), you might already know that you can change the data of a normal text field using this JavaScript code:

1
$j('#fieldname').val('new value');

But if your field is an image field, the above code won’t work. Try this instead:

1
$j('#fieldname-image').attr('src', './images/new-image.png');

Of course, change fieldname in the above code to the actual field name.