A bit of a rewrite to move all the js into form.media and store the dynamic data in data attributes