Dark Ambient
2006-Nov-03 16:36 UTC
Resolved but one minor detail- Re: [Rails] Re: Weird error now - RJS not working
Even though I''ve set this up to update the table it is putting the data outside of the table. <div id="canskills"> <tr> <td align="LEFT"><%= canskill.skill %></td> <td align="LEFT"><%= canskill.skill_level.name%></td> <td align="LEFT"><%=canskill.skill_experience_year.name %></td> <td align="LEFT"><%= canskill.skill_last_use.name %></td> </tr> </div> I do have it set for bottom, and I''ve put the div tags in a number of places. Stuart On 11/3/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Bump . sorry still stuck on this and hopefully someone can help. > I''m wondering if my rest based controller is the problem. > I don''t think the URL should be changing. > > > > On 11/3/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > On 11/2/06, Dark Ambient < sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Still not sure what I''m missing here. I''ve done some reading up with > > > the RJS Templates book. > > > Here is what I''m trying to do. > > > > > > I have a page, on the bottom portion is a form, on the top is a > > > table. User makes entry into form,hits submit table gets another row. > > > I''ll probably add an additonal button at some point to exit the > > > screen. > > > > > > This is the form (at least the important part - > > > <table id="skills"> #this starts the table with the inputted > > > information > > > <tr><th>Skill</th><th>Skill level</th><th>Experience</th><th>Last > > > use</th></tr> > > > <%= render :partial => ''canskills/canskill'' ,:collection => @ > > > candidate.canskills %> > > > </table> > > > Now the form itself : > > > <% remote_form_for :canskill, :url => canskill_url, :html => { :id => > > > ''canskill-form'' }, :candidate_id => @candidate_id do |form| %> > > > #various fields................ > > > ................................... > > > ................................... > > > %= submit_tag "add skill" %> > > > > > > I have a create.rjs to accompany the controller action create. > > > rjs : > > > page.insert_html :bottom, ''canskills'', :partial => ''canskill'' > > > page.form.reset ''canskill-form'' > > > > > > Then the controller action: > > > pretty simple: > > > > > > def create > > > @canskill = Canskill.new(params[:canskill]) > > > @candidate_id = params[:candidate_id] > > > end > > > > > > However on submit all I get currently is this rjs error page - > > > > > > try { > > > new Insertion.Bottom("canskills", "<tr>\n<div id=\"new-canskill\">\n <td td align=\"LEFT\">Internet > > > > > > > > > > > > engineer</td>\n <td td align=\"LEFT\">Intermediate</td>\n <td td align=\"LEFT\">3 - 4 years</td>\n > > > <td td align=\"LEFT\">1 year ago</td>\n </div>\n</tr>\n\n\n\n"); > > > > > > > > > > > > Form.reset("canskill-form"); > > > } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''new > > > Insertion.Bottom(\"canskills\", \"<tr>\n<div id=\\"new-canskill\\">\n <td td align=\\"LEFT\\"> > > > > > > > > > > > > Internet engineer</td>\n <td td align=\\"LEFT\\">Intermediate</td>\n <td td align=\\"LEFT\\">3 - > > > 4 years</td>\n <td td align=\\"LEFT\\">1 year ago</td>\n </div>\n</tr>\n\n\n\n\");\nForm.reset > > > > > > > > > > > > (\"canskill-form\");''); throw e } > > > > > > Reading more perhaps this is not an error as much as it''s showing me > > the javascript. > > One thing is that when I hit submit, and the rjs text message appears > > I''m back at a different URL. > > > > the form and table sits at /id/candidates/canskills/new > > yet after submit, the rjs quotes above appears at > > /id/candidate/canskills > > > > ? > > Stuart > > > > > > > > > -- > http://en.wikipedia.org/wiki/Dark_ambient >-- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jason Norris
2006-Nov-03 19:38 UTC
Re: Resolved but one minor detail- Re: [Rails] Re: Weird error now - RJS not working
I tried to update part of a table with AJAX but no luck. What I did was create a new table inside of a single cell(possibly using rowspan/colspan), and update the whole inner table. It''s ugly, and I had to add a single-row table for each update. If anyone knows a better way, I''d like to hear it. AFAIK you cannot create a div inside a table that contains table rows, but I may be wrong here. Jason Dark Ambient wrote:> Even though I''ve set this up to update the table it is putting the > data outside of the table. > > <div id="canskills"> > <tr> > <td align="LEFT"><%= canskill.skill %></td> > <td align="LEFT"><%= canskill.skill_level.name%></td> > <td align="LEFT"><%=canskill.skill_experience_year.name %></td> > <td align="LEFT"><%= canskill.skill_last_use.name %></td> > </tr> > </div> > > I do have it set for bottom, and I''ve put the div tags in a number of > places. > > Stuart > > > On 11/3/06, *Dark Ambient* <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > <mailto:sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote: > > Bump . sorry still stuck on this and hopefully someone can help. > I''m wondering if my rest based controller is the problem. > I don''t think the URL should be changing. > > > > > On 11/3/06, *Dark Ambient* <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > <mailto:sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote: > > > > On 11/2/06, *Dark Ambient* < sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > <mailto:sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote: > > Still not sure what I''m missing here. I''ve done some > reading up with the RJS Templates book. > Here is what I''m trying to do. > > I have a page, on the bottom portion is a form, on the top > is a table. User makes entry into form,hits submit table > gets another row. > I''ll probably add an additonal button at some point to > exit the screen. > > This is the form (at least the important part - > <table id="skills"> #this starts the table with the > inputted information > <tr><th>Skill</th><th>Skill > level</th><th>Experience</th><th>Last use</th></tr> > <%= render :partial => ''canskills/canskill'' ,:collection > => @candidate.canskills %> > </table> > Now the form itself : > <% remote_form_for :canskill, :url => canskill_url, :html > => { :id => ''canskill-form'' }, :candidate_id => > @candidate_id do |form| %> > #various fields................ > ................................... > ................................... > %= submit_tag "add skill" %> > > I have a create.rjs to accompany the controller action create. > rjs : > page.insert_html :bottom, ''canskills'', :partial => ''canskill'' > page.form.reset ''canskill-form'' > > Then the controller action: > pretty simple: > > def create > @canskill = Canskill.new(params[:canskill]) > @candidate_id = params[:candidate_id] > end > > However on submit all I get currently is this rjs error > page - > > try { > new Insertion.Bottom("canskills", "<tr>\n<div id=\"new-canskill\">\n <td td align=\"LEFT\">Internet > > > > > engineer</td>\n <td td align=\"LEFT\">Intermediate</td>\n <td td align=\"LEFT\">3 - 4 years</td>\n > <td td align=\"LEFT\">1 year ago</td>\n </div>\n</tr>\n\n\n\n"); > > > > > Form.reset("canskill-form"); > } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''new > Insertion.Bottom(\"canskills\", \"<tr>\n<div id=\\"new-canskill\\">\n <td td align=\\"LEFT\\"> > > > > > Internet engineer</td>\n <td td align=\\"LEFT\\">Intermediate</td>\n <td td align=\\"LEFT\\">3 - > 4 years</td>\n <td td align=\\"LEFT\\">1 year ago</td>\n </div>\n</tr>\n\n\n\n\");\nForm.reset > > > > > (\"canskill-form\");''); throw e } > > Reading more perhaps this is not an error as much as it''s > showing me the javascript. > One thing is that when I hit submit, and the rjs text message > appears I''m back at a different URL. > > the form and table sits at /id/candidates/canskills/new > yet after submit, the rjs quotes above appears at > /id/candidate/canskills > > ? > Stuart > > > > > > -- > http://en.wikipedia.org/wiki/Dark_ambient > > > > > -- > http://en.wikipedia.org/wiki/Dark_ambient > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---