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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wes Gamble
2006-Nov-11 22:19 UTC
Re: Setting Ajax.Updater update target to alternate window?
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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Wes Gamble
2006-Nov-13 17:25 UTC
Re: Setting Ajax.Updater update target to alternate window?
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<BR/><BR/><IMG src="'' + wait_image_url +
''"/>'';
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;
}
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---