I have an inline iframe which has a form in it, when the form is
updated, I would like to call an RJS template that will update the
parent page.
±----------------------------------------------+
| |
|
Update with RJS
|
| |
| ±--------------------------------+ |
| |
If anybody has a clean way to do this, would be interested. But
otherwise have solved it by coding native javascript
FYI this was to create an inline image uploader as you can’t do this
with ajax so I embedded an iframe and wrapped it with javascript to
emulate ajax.
On the iframe;
javascript_tag(
“window.parent.myFunctionOnTheParentWindow(’#{@object.id}’)”)
and then on the parent form;
function myFunctionOnTheParentWindow(object_it) {
if (photo_id) {
new Ajax.Updater(‘photo_items’, ‘/admin/photo_show’,
{asynchronous:true, evalScripts:true,
insertion:Insertion.Bottom,
onComplete:function(request){Element.hide(“photo_upload_saving”); new
Effect.Highlight(‘photo_box_’ + photo.id);},
onLoading:function(request){Effect.BlindUp(“photo_new”)},
parameters: “id=” + photo_id});
}
}
works perfectly.