You can actually just high-jack the post with JQuery and then when it sends 
back the new page you can filter it and display just that message.
______________________________________
From: radiant-boun...@radiantcms.org [radiant-boun...@radiantcms.org] On Behalf 
Of Greg Dart [greg_d...@yahoo.co.uk]
Sent: Saturday, August 08, 2009 3:48 PM
To: radiant@radiantcms.org
Subject: [Radiant] Ajax with mailer extension

Hello,

I'm new to Radiant (and fairly new to Rails) so please be gentle....

I've got a contact form working using the Mailer Extension - the contact form 
is in a snippet on the sidebar of the home page. What I would like to achieve 
is that when the contact form is submitted and the email successfully sent, 
rather than redirecting to a new page, I'd like an AJAX like effect to change 
the heading of the contact form to "Mail Sent!".

Based on research to date, I'm trying to follow articles about RJS and so I've 
tried adding the following to the  
../vendor/extensions/mailer/app/mail_controller.rb file:

               page.replace_html 'contactmsg', 'Mail Sent!'

Where 'contactmsg' is the id of a div in the snippet. But I get errors about 
unknown variable "page". Reading further, I realise this kind of stuff should 
be in an .rjs file, in a view directory? But Radiant projects don't have 
"views" do they...? So how can I achieve an RJS or AJAX like effect to update 
one part of the page based on some logic happening in a controller?

If I'm going about this in completely the wrong way please feel free to 
re-direct me...

Thanks,
Greg


_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to