I have a simlple view: <h2>Tags</h2> <% unless @recipe.tags.empty? %> <table> <tbody id="tags"> <%= render :partial=>''tags/tag'', :collection=>@recipe.tags %> </tbody> </table> <% end %> <% form_remote_tag :url=>tags_path(@recipe) do%> <label>Name</label> <%= text_field_with_auto_complete :tag, :name %> <%= submit_tag "Add Tag" %> <% end %> Which has a pretty simple create method that renders the RJS as follows: format.js { render :update do |page| page.insert_html :bottom, ''tags'', :partial=>''tags/tag'' end } The problem is that no insertion happens. Under IE I get an RJS alert, under FF I get nothing. Firebug reports that the POST request is successful and has the has the correct results: try { new Insertion.Bottom("tags", "<tr>\n <td>Please Work</td>\n <td><a href=\"/recipes/6/tags/28;edit\">Edit</a></td>\n <td><a href=\"/recipes/6/tags/28\" onclick=\"if (confirm(''Are you sure?'')) { var f = document.createElement(''form''); f.style.display = ''none''; this.parentNode.appendChild(f); f.method = ''POST''; f.action this.href;var m = document.createElement(''input''); m.setAttribute(''type'', ''hidden''); m.setAttribute(''name'', ''_method''); m.setAttribute(''value'', ''delete''); f.appendChild(m);f.submit(); };return false;\">Delete</a></td>\n</tr>\n"); } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''new Insertion.Bottom(\"tags\", \"<tr>\\n <td>Please Work</td>\\n <td><a href=\\\"/recipes/6/tags/28;edit\\\">Edit</a></td>\\n <td><a href=\\\"/recipes/6/tags/28\\\" onclick=\\\"if (confirm(\''Are you sure?\'')) { var f = document.createElement(\''form\''); f.style.display = \''none\''; this.parentNode.appendChild(f); f.method = \''POST\''; f.action = this.href;var m = document.createElement(\''input\''); m.setAttribute(\''type\'', \''hidden\''); m.setAttribute(\''name\'', \''_method\''); m.setAttribute(\''value\'', \''delete\''); f.appendChild(m);f.submit(); };return false;\\\">Delete</a></td>\\n</tr>\\n\");\n''); throw e } I threw the above JS into a test page and it works successfully, but for some reason it is not working through the form. Again, in IE the error is thrown, and in Fire Fox nothing is happenning at all. No warnings or errors are thrown. Anyone have any ideas on what I am doing wrong? Thanks, Dan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Are the prototype and scriptaculous libraries listed in the head of the layout? I imagine that without them POST will still return the RJS but the browser wont do anything with it. - Richard On Apr 4, 2:34 pm, "Daniel Curran" <codet...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a simlple view: > > <h2>Tags</h2> > <% unless @recipe.tags.empty? %> > <table> > <tbody id="tags"> > <%= render :partial=>''tags/tag'', :collection=>@recipe.tags %> > </tbody> > </table> > <% end %> > <% form_remote_tag :url=>tags_path(@recipe) do%> > <label>Name</label> <%= text_field_with_auto_complete :tag, :name %> > <%= submit_tag "Add Tag" %> > <% end %> > > Which has a pretty simple create method that renders the RJS as follows: > > format.js { > render :update do |page| > page.insert_html :bottom, ''tags'', :partial=>''tags/tag'' > end > } > > The problem is that no insertion happens. Under IE I get an RJS alert, > under FF I get nothing. > Firebug reports that the POST request is successful and has the has > the correct results: > > try { > new Insertion.Bottom("tags", "<tr>\n <td>Please Work</td>\n > <td><a href=\"/recipes/6/tags/28;edit\">Edit</a></td>\n <td><a > href=\"/recipes/6/tags/28\" onclick=\"if (confirm(''Are you sure?'')) { > var f = document.createElement(''form''); f.style.display = ''none''; > this.parentNode.appendChild(f); f.method = ''POST''; f.action > this.href;var m = document.createElement(''input''); > m.setAttribute(''type'', ''hidden''); m.setAttribute(''name'', ''_method''); > m.setAttribute(''value'', ''delete''); f.appendChild(m);f.submit();};return false;\">Delete</a></td>\n</tr>\n"); > } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''new > > Insertion.Bottom(\"tags\", \"<tr>\\n <td>Please Work</td>\\n > <td><a href=\\\"/recipes/6/tags/28;edit\\\">Edit</a></td>\\n <td><a > href=\\\"/recipes/6/tags/28\\\" onclick=\\\"if (confirm(\''Are you > sure?\'')) { var f = document.createElement(\''form\''); f.style.display > = \''none\''; this.parentNode.appendChild(f); f.method = \''POST\''; > f.action > = this.href;var m = document.createElement(\''input\''); > m.setAttribute(\''type\'', \''hidden\''); m.setAttribute(\''name\'', > \''_method\''); m.setAttribute(\''value\'', \''delete\''); > f.appendChild(m);f.submit(); };return > false;\\\">Delete</a></td>\\n</tr>\\n\");\n''); throw e > > } > > I threw the above JS into a test page and it works successfully, but > for some reason it is not working through the form. Again, in IE the > error is thrown, and in Fire Fox nothing is happenning at all. No > warnings or errors are thrown. > > Anyone have any ideas on what I am doing wrong? > > Thanks, > Dan--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I have the following in the top of the HTML output, via <%javascript_include_tag :defaults %> <script src="/javascripts/prototype.js?1171470794" type="text/javascript"></script> <script src="/javascripts/effects.js?1171470794" type="text/javascript"></script> <script src="/javascripts/dragdrop.js?1171470794" type="text/javascript"></script> <script src="/javascripts/controls.js?1171470794" type="text/javascript"></script> <script src="/javascripts/application.js?1171470794" type="text/javascript"></script> IE is trying to do something with it, as the exception case is being thrown. I have not gone down the route of adding breakpoints into the Prototype library via Firebug to figure out what has been fired and what has not been fired. That will be my next step. Another note is that text_field_with_auto_complete is working fine, so the javascript libraries are working and performing remote call successfully. It is just my form_remote_tag and the RJS that is not doing what I would expect it to. The On 4/4/07, Richard Luther <richard.luther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Are the prototype and scriptaculous libraries listed in the head of > the layout? I imagine that without them POST will still return the RJS > but the browser wont do anything with it. > - Richard > > On Apr 4, 2:34 pm, "Daniel Curran" <codet...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have a simlple view: > > > > <h2>Tags</h2> > > <% unless @recipe.tags.empty? %> > > <table> > > <tbody id="tags"> > > <%= render :partial=>''tags/tag'', :collection=>@recipe.tags %> > > </tbody> > > </table> > > <% end %> > > <% form_remote_tag :url=>tags_path(@recipe) do%> > > <label>Name</label> <%= text_field_with_auto_complete :tag, :name %> > > <%= submit_tag "Add Tag" %> > > <% end %> > > > > Which has a pretty simple create method that renders the RJS as follows: > > > > format.js { > > render :update do |page| > > page.insert_html :bottom, ''tags'', :partial=>''tags/tag'' > > end > > } > > > > The problem is that no insertion happens. Under IE I get an RJS alert, > > under FF I get nothing. > > Firebug reports that the POST request is successful and has the has > > the correct results: > > > > try { > > new Insertion.Bottom("tags", "<tr>\n <td>Please Work</td>\n > > <td><a href=\"/recipes/6/tags/28;edit\">Edit</a></td>\n <td><a > > href=\"/recipes/6/tags/28\" onclick=\"if (confirm(''Are you sure?'')) { > > var f = document.createElement(''form''); f.style.display = ''none''; > > this.parentNode.appendChild(f); f.method = ''POST''; f.action > > this.href;var m = document.createElement(''input''); > > m.setAttribute(''type'', ''hidden''); m.setAttribute(''name'', ''_method''); > > m.setAttribute(''value'', ''delete''); f.appendChild(m);f.submit();};return false;\">Delete</a></td>\n</tr>\n"); > > } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''new > > > > Insertion.Bottom(\"tags\", \"<tr>\\n <td>Please Work</td>\\n > > <td><a href=\\\"/recipes/6/tags/28;edit\\\">Edit</a></td>\\n <td><a > > href=\\\"/recipes/6/tags/28\\\" onclick=\\\"if (confirm(\''Are you > > sure?\'')) { var f = document.createElement(\''form\''); f.style.display > > = \''none\''; this.parentNode.appendChild(f); f.method = \''POST\''; > > f.action > > = this.href;var m = document.createElement(\''input\''); > > m.setAttribute(\''type\'', \''hidden\''); m.setAttribute(\''name\'', > > \''_method\''); m.setAttribute(\''value\'', \''delete\''); > > f.appendChild(m);f.submit(); };return > > false;\\\">Delete</a></td>\\n</tr>\\n\");\n''); throw e > > > > } > > > > I threw the above JS into a test page and it works successfully, but > > for some reason it is not working through the form. Again, in IE the > > error is thrown, and in Fire Fox nothing is happenning at all. No > > warnings or errors are thrown. > > > > Anyone have any ideas on what I am doing wrong? > > > > Thanks, > > Dan > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Maybe Matching Threads
- How to get dynamically created inputs from html form back to rails app
- link_to, how do you combine url options and html_options?
- Contribution on extending createElement
- [PATCH 1/2] Refactor guest and volume creation into Sys::VirtV2V::Target::LibVirt
- Is there a problem with webrat?