Hi, I have implemented some RJS code and I have the same exact code in 2 different places. In one place I get the error "Element.update is not a function" and the other place works fine. Any idea why this error is coming? Breaking my head. -Vinod --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The Javascript generated looks like:
<div id="newpost">
<a href="#" onclick="try {
Element.update("newpost",
"<head>\n\n</head>\n<body>\n\n
<form
action=\"/video/updatepost?topic_id=51&amp;amp;parent_post_id=&amp;amp;divname=newpost\"
method=\"post\" onsubmit=\"new
Ajax.Updater(''newpost'',
''/video/updatepost?topic_id=51&amp;parent_post_id=&amp;divname=newpost'',
{asynchronous:true, evalScripts:true,
parameters:Form.serialize(this)}); return
false;\">\n\n<table width=100%>\n
\n
<tr valign=\"top\">\n <td>\n
<span
style=\"font-family: Verdana, Arial, Sans-Serif; font-size:
10px\">\n <textarea cols=\"40\"
id=\"postmessage\" name=\"postmessage\"
rows=\"3\"></textarea>\n
</span>\n
</td>\n <td>\n <input
id=\"commit\"
name=\"commit\" type=\"hidden\"
value=\"Post\" />\n <table>\n
<tr>\n <td>\n <input
id=\"SubmitPost_newpost\" name=\"_commit\"
type=\"submit\" value=\"Post\" />\n
</td>\n </tr>\n\n <tr>\n
<td>\n <input
id=\"DiscardPost_newpost\"
name=\"_commit\" onclick=\"Form.getInputs(this.form,
null, ''commit'')[0].value =
''Discard''\" type=\"submit\"
value=\"Discard\" />\n </td>\n
</tr>\n </table>\n </td>\n
</tr>\n</table>\n</form>\n</body>");
} catch (e) { alert(''RJS error:\n\n'' + e.toString());
alert(''Element.update(\"newpost\",
\"<head>\n\n</head>\n<body>\n\n
<form
action=\\"/video/updatepost?topic_id=51&amp;amp;parent_post_id=&amp;amp;divname=newpost\\"
method=\\"post\\" onsubmit=\\"new
Ajax.Updater(\''newpost\'',
\''/video/updatepost?topic_id=51&amp;parent_post_id=&amp;divname=newpost\'',
{asynchronous:true, evalScripts:true,
parameters:Form.serialize(this)}); return
false;\\">\n\n<table width=100%>\n
\n
<tr valign=\\"top\\">\n <td>\n
<span
style=\\"font-family: Verdana, Arial, Sans-Serif; font-size:
10px\\">\n <textarea
cols=\\"40\\"
id=\\"postmessage\\" name=\\"postmessage\\"
rows=\\"3\\"></textarea>\n
</span>\n
</td>\n <td>\n <input
id=\\"commit\\"
name=\\"commit\\" type=\\"hidden\\"
value=\\"Post\\" />\n <table>\n
<tr>\n <td>\n <input
id=\\"SubmitPost_newpost\\"
name=\\"_commit\\"
type=\\"submit\\" value=\\"Post\\"
/>\n
</td>\n </tr>\n\n
<tr>\n
<td>\n <input
id=\\"DiscardPost_newpost\\"
name=\\"_commit\\"
onclick=\\"Form.getInputs(this.form, null,
\''commit\'')[0].value \''Discard\''\\"
type=\\"submit\\"
value=\\"Discard\\" />\n </td>\n
</tr>\n </table>\n </td>\n
</tr>\n</table>\n</form>\n</body>\");'');
throw e }; return false;">Post a new comment</a>
</div>
On 8/24/06, Vinod Krishnan
<vinod.krishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
> I have implemented some RJS code and I have the same exact code in 2
> different places. In one place I get the error "Element.update is not
> a function" and the other place works fine. Any idea why this error is
> coming? Breaking my head.
>
> -Vinod
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
I simplified the JS code to:
<div id="newpost">
<a href="#" onclick="try {
Element.update(''newpost'', ''hello'');
} catch (e) { alert(''RJS error:\n\n'' + e.toString());
alert(''Element.update(\"newpost\",
\"hello\");'');
throw e }; return false;">Post</a>
</div>
and still the error
On 8/24/06, Vinod Krishnan
<vinod.krishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> The Javascript generated looks like:
>
> <div id="newpost">
> <a href="#" onclick="try {
> Element.update("newpost",
>
"<head>\n\n</head>\n<body>\n\n
<form
>
action=\"/video/updatepost?topic_id=51&amp;amp;parent_post_id=&amp;amp;divname=newpost\"
> method=\"post\" onsubmit=\"new
Ajax.Updater(''newpost'',
>
''/video/updatepost?topic_id=51&amp;parent_post_id=&amp;divname=newpost'',
> {asynchronous:true, evalScripts:true,
> parameters:Form.serialize(this)}); return
> false;\">\n\n<table width=100%>\n
\n
> <tr valign=\"top\">\n
<td>\n <span
> style=\"font-family: Verdana, Arial, Sans-Serif; font-size:
> 10px\">\n <textarea
cols=\"40\"
> id=\"postmessage\" name=\"postmessage\"
> rows=\"3\"></textarea>\n
</span>\n
> </td>\n <td>\n <input
id=\"commit\"
> name=\"commit\" type=\"hidden\"
> value=\"Post\" />\n <table>\n
> <tr>\n <td>\n <input
> id=\"SubmitPost_newpost\"
name=\"_commit\"
> type=\"submit\" value=\"Post\"
/>\n
> </td>\n </tr>\n\n
<tr>\n
> <td>\n <input
id=\"DiscardPost_newpost\"
> name=\"_commit\"
onclick=\"Form.getInputs(this.form,
> null, ''commit'')[0].value =
''Discard''\" type=\"submit\"
> value=\"Discard\" />\n
</td>\n
> </tr>\n </table>\n
</td>\n
>
</tr>\n</table>\n</form>\n</body>");
> } catch (e) { alert(''RJS error:\n\n'' + e.toString());
> alert(''Element.update(\"newpost\",
>
\"<head>\n\n</head>\n<body>\n\n
<form
>
action=\\"/video/updatepost?topic_id=51&amp;amp;parent_post_id=&amp;amp;divname=newpost\\"
> method=\\"post\\" onsubmit=\\"new
> Ajax.Updater(\''newpost\'',
>
\''/video/updatepost?topic_id=51&amp;parent_post_id=&amp;divname=newpost\'',
> {asynchronous:true, evalScripts:true,
> parameters:Form.serialize(this)}); return
> false;\\">\n\n<table width=100%>\n
\n
> <tr valign=\\"top\\">\n
<td>\n <span
> style=\\"font-family: Verdana, Arial, Sans-Serif; font-size:
> 10px\\">\n <textarea
cols=\\"40\\"
> id=\\"postmessage\\"
name=\\"postmessage\\"
> rows=\\"3\\"></textarea>\n
</span>\n
> </td>\n <td>\n <input
id=\\"commit\\"
> name=\\"commit\\" type=\\"hidden\\"
> value=\\"Post\\" />\n <table>\n
> <tr>\n <td>\n <input
> id=\\"SubmitPost_newpost\\"
name=\\"_commit\\"
> type=\\"submit\\" value=\\"Post\\"
/>\n
> </td>\n </tr>\n\n
<tr>\n
> <td>\n <input
> id=\\"DiscardPost_newpost\\"
name=\\"_commit\\"
> onclick=\\"Form.getInputs(this.form, null,
\''commit\'')[0].value >
\''Discard\''\\" type=\\"submit\\"
> value=\\"Discard\\" />\n
</td>\n
> </tr>\n </table>\n
</td>\n
>
</tr>\n</table>\n</form>\n</body>\");'');
> throw e }; return false;">Post a new comment</a>
> </div>
>
> On 8/24/06, Vinod Krishnan
<vinod.krishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Hi,
> > I have implemented some RJS code and I have the same exact code in 2
> > different places. In one place I get the error "Element.update is
not
> > a function" and the other place works fine. Any idea why this
error is
> > coming? Breaking my head.
> >
> > -Vinod
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Figured it out.. Forgot to add the prototype.js On 8/24/06, Vinod Krishnan <vinod.krishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I simplified the JS code to: > > <div id="newpost"> > <a href="#" onclick="try { > Element.update(''newpost'', ''hello''); > } catch (e) { alert(''RJS error:\n\n'' + e.toString()); > alert(''Element.update(\"newpost\", \"hello\");''); > throw e }; return false;">Post</a> > </div> > > and still the error > > On 8/24/06, Vinod Krishnan <vinod.krishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > The Javascript generated looks like: > > > > <div id="newpost"> > > <a href="#" onclick="try { > > Element.update("newpost", > > "<head>\n\n</head>\n<body>\n\n <form > > action=\"/video/updatepost?topic_id=51&amp;amp;parent_post_id=&amp;amp;divname=newpost\" > > method=\"post\" onsubmit=\"new Ajax.Updater(''newpost'', > > ''/video/updatepost?topic_id=51&amp;parent_post_id=&amp;divname=newpost'', > > {asynchronous:true, evalScripts:true, > > parameters:Form.serialize(this)}); return > > false;\">\n\n<table width=100%>\n \n > > <tr valign=\"top\">\n <td>\n <span > > style=\"font-family: Verdana, Arial, Sans-Serif; font-size: > > 10px\">\n <textarea cols=\"40\" > > id=\"postmessage\" name=\"postmessage\" > > rows=\"3\"></textarea>\n </span>\n > > </td>\n <td>\n <input id=\"commit\" > > name=\"commit\" type=\"hidden\" > > value=\"Post\" />\n <table>\n > > <tr>\n <td>\n <input > > id=\"SubmitPost_newpost\" name=\"_commit\" > > type=\"submit\" value=\"Post\" />\n > > </td>\n </tr>\n\n <tr>\n > > <td>\n <input id=\"DiscardPost_newpost\" > > name=\"_commit\" onclick=\"Form.getInputs(this.form, > > null, ''commit'')[0].value = ''Discard''\" type=\"submit\" > > value=\"Discard\" />\n </td>\n > > </tr>\n </table>\n </td>\n > > </tr>\n</table>\n</form>\n</body>"); > > } catch (e) { alert(''RJS error:\n\n'' + e.toString()); > > alert(''Element.update(\"newpost\", > > \"<head>\n\n</head>\n<body>\n\n <form > > action=\\"/video/updatepost?topic_id=51&amp;amp;parent_post_id=&amp;amp;divname=newpost\\" > > method=\\"post\\" onsubmit=\\"new > > Ajax.Updater(\''newpost\'', > > \''/video/updatepost?topic_id=51&amp;parent_post_id=&amp;divname=newpost\'', > > {asynchronous:true, evalScripts:true, > > parameters:Form.serialize(this)}); return > > false;\\">\n\n<table width=100%>\n \n > > <tr valign=\\"top\\">\n <td>\n <span > > style=\\"font-family: Verdana, Arial, Sans-Serif; font-size: > > 10px\\">\n <textarea cols=\\"40\\" > > id=\\"postmessage\\" name=\\"postmessage\\" > > rows=\\"3\\"></textarea>\n </span>\n > > </td>\n <td>\n <input id=\\"commit\\" > > name=\\"commit\\" type=\\"hidden\\" > > value=\\"Post\\" />\n <table>\n > > <tr>\n <td>\n <input > > id=\\"SubmitPost_newpost\\" name=\\"_commit\\" > > type=\\"submit\\" value=\\"Post\\" />\n > > </td>\n </tr>\n\n <tr>\n > > <td>\n <input > > id=\\"DiscardPost_newpost\\" name=\\"_commit\\" > > onclick=\\"Form.getInputs(this.form, null, \''commit\'')[0].value > > \''Discard\''\\" type=\\"submit\\" > > value=\\"Discard\\" />\n </td>\n > > </tr>\n </table>\n </td>\n > > </tr>\n</table>\n</form>\n</body>\");''); > > throw e }; return false;">Post a new comment</a> > > </div> > > > > On 8/24/06, Vinod Krishnan <vinod.krishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > I have implemented some RJS code and I have the same exact code in 2 > > > different places. In one place I get the error "Element.update is not > > > a function" and the other place works fine. Any idea why this error is > > > coming? Breaking my head. > > > > > > -Vinod > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---