Hi.
Im using the built in thickbox to upload files for my cycle plugin in a custom meta box. I have multiple fields, but if i upload and insert in one field – it gets input’ed into all of the fields.
HTML:
<label>
Bild:
<br />
<input type="text" class="imagecycle_image" name="imagecycle0[image]" value="" size="35" />
<input class="upload_image_button" value="Get image" type="button" onclick="myMediaPopupHandler();" />
</label>
jQuery:
function myMediaPopupHandler()
{
var formfield;
window.send_to_editor = function(html) {
fileurl = jQuery('img',html).attr('src');
formfield.val(fileurl);
tb_remove();
}
formfield = jQuery('.upload_image_button').prev('input');
tb_show('', 'media-upload.php?type=image&tab=library&TB_iframe=true');
return false;
}
So I have multiple instances of the uploading fields (gets added via javascript), and if i choose to upload for field 1, the result gets inputed into all fields. It seems like the prev(‘input’) part does not work.. Please help!