Setting Ajax.Updater update target to alternate window?

I need to make a call to Ajax.Updater(container, url, options) where
container needs to be a DOM element in another window.

So assuming my form is in window “X”, can I specify a DOM element in
window “Y” as the update target for my AJAX call?

If I can, what is the correct syntax?

Thanks,
Wes

Alternatively, I’m interested in how to dynamically add a form to a
document using the DOM in Javascript.

I’m trying

newForm = document.createElement('form');

but doesn’t seem to be showing up in the document forms array.

Thanks,
Wes

I ended up with the Javascript function below.

This:

  • Opens a popup
  • Adds a DIV with wait message and graphic
  • Submits the form request
  • Eval’s the response from the form request which is something along the
    lines of:

page.assign(‘popup.location.href’, ‘…data…’)

which takes the output of the form submission and renders to the
browser.

Wes

==========================================================================

function submit_form_to_popup(form, popup_window_name, action) {
form.action = action;
popup = window.open(’’, popup_window_name, ‘width=800, height=700,
left = 450, top = 100, resizable, scrollbars=yes’);
wait_image_url = window.location.protocol + ‘//’ +
window.location.host + ‘/images/indicator_verybig.gif’;

//Create a DIV in the popup window and populate it with the AJAX wait
message and graphic.
newDiv = popup.document.createElement(‘div’);
newDiv.setAttribute(‘id’, ‘pdf’);
newDiv.setAttribute(‘style’, ‘margin-top: 250px; text-align:
center;’);
newDiv.innerHTML = ‘Please wait while your forms are
generated

’;
popup.document.body.appendChild(newDiv);

//Submit the form asynchronously and execute Javascript returned from
the action.
new Ajax.Request(form.action, { asynchronous: true, method:
‘post’, parameters: Form.serialize(form), evalScripts:
true,
onSuccess: function(request)
{eval(request.responseText);}
});
return false;
}

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs