Okay, so I''ve modified my events javascript to this:
Event.observe(window, ''load'', function() {
Event.observe(''application_form'', ''submit'',
function(e) {
new Ajax.Updater(''application_frame'',
''/application/request'', {
parameters: $(''application_form'').serialize(true)
});
Event.stop(e);
});
});
Unfortunately, when I use the default ''post'' method, it
doesn''t seem
to post correctly to the page. It works fine when I use the
''get''
method however, but I would like to stick with ''post''. Any
suggestions? Thanks!
On Jul 25, 3:32 pm, Travis
<Travis.Pax...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I am trying to use Form.request to post a form to a PHP page. I would
> like the results of the page to be dumped onto the screen using
> something like Ajax.updater.
>
> This is my main html page:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>Source Dynamics</title>
> <link rel="stylesheet" type="text/css"
href="css/standard.css" />
> <script type="text/javascript"
src="scripts/prototype.js"></script>
> <script type="text/javascript"
src="scripts/events.js"></script>
> </head>
> <body>
> <form id="application_form" method="post"
action="/application">
> <span id="application_message"></span>
> <div id="application_frame"></div>
> </form>
> </body>
> </html>
>
> This is my events.js file:
>
> Event.observe(window, ''load'', function() {
> new Ajax.Updater(''application_frame'',
''/application'');
> Event.observe(''application_form'',
''submit'', function(e) {
> $(''application_form'').request( {
> parameters: {
> ''formValues'':''values[]''
> },
> onSuccess: function() {
> $(''application_message'').hide();
> },
> onFailure: function() {
> $(''application_message'').show();
> }
> });
> $(''application_form'').focusFirstElement();
> Event.stop(e);
> });
>
> });
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---