I have a button which calls a form via Ajax.Updater:
<a href="javascript:void()"
onclick="createMessage()">Create Message</
a>
<script>
function createMessage() {
new Ajax.Updater( ''content'',
''message.php'', { method: ''post'' } );
}
</script>
This is the message.php file:
<html>
<head>
<script language="JavaScript" type="text/javascript"
src="prototype.js"></script>
</head>
<body>
<form id="FYIForm">
<table>
<tr><td>Message: </td><td
colspan="2"><textarea cols="39" rows="8"
name="info"
id="info"></textarea></td></tr>
<tr><td></td><td><input type="button"
onclick="addMessage()"
value="Add FYI"
class="def"></td></tr>
</table>
</form>
<script>
function addFYI() {
new Ajax.Updater( ''fyi'', ''addmessage.php'',
{ method: ''post'',
parameters: $(''FYIForm'').serialize() } );
$(''FYIForm'').reset();
}
</script>
</body>
</html>
The problem is that the addMessage() function does not execute. It
does not make a call to my addmessage.php file.
Any help would be greatly appreciated!! 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
-~----------~----~----~----~------~----~------~--~---
T.J. Crowder
2008-Apr-30 07:43 UTC
Re: Making new Ajax.Updater within a previous Ajax.Updater call
Hi Geoff, Have you walked through with a debugger? In this case I think it''s just a rename gone bad -- the click handler on the "Add FYI" button tries to call "addMessage", but there is no addMessage() function, there''s an addFYI() function. Hope this helps, -- T.J. Crowder tj / crowder software / com On Apr 29, 3:22 pm, Geoff <vg3...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a button which calls a form via Ajax.Updater: > > <a href="javascript:void()" onclick="createMessage()">Create Message</ > a> > <script> > function createMessage() { > new Ajax.Updater( ''content'', ''message.php'', { method: ''post'' } );} > > </script> > > This is the message.php file: > > <html> > <head> > <script language="JavaScript" type="text/javascript" > src="prototype.js"></script> > </head> > <body> > <form id="FYIForm"> > <table> > <tr><td>Message: </td><td colspan="2"><textarea cols="39" rows="8" > name="info" id="info"></textarea></td></tr> > <tr><td></td><td><input type="button" onclick="addMessage()" > value="Add FYI" class="def"></td></tr> > > </table> > </form> > <script> > function addFYI() { > new Ajax.Updater( ''fyi'', ''addmessage.php'', { method: ''post'', > parameters: $(''FYIForm'').serialize() } ); > $(''FYIForm'').reset();} > > </script> > </body> > </html> > > The problem is that the addMessage() function does not execute. It > does not make a call to my addmessage.php file. > > Any help would be greatly appreciated!! 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 -~----------~----~----~----~------~----~------~--~---