Search the web
Sign In
New User? Sign Up
novarubygroup · The Ruby User Group of Northern Virginia
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Registration Open...2009 RubyRX/AgileRX Tour comes to Reston, VA on   Message List  
Reply | Forward Message #1825 of 1952 |
Re: [novarubygroup] basic rails ajax questions

I tried what you said and it still behaved differently in Firefox and IE.
But then I tried moving the form_for outside of the entire TABLE, at which
point it started working. What I wanted was to have a form for each line of
the table - maybe I would need nested tables or something. My ruby/rails
education goes on.....


Thanks

John

On Tue, Jun 30, 2009 at 9:23 AM, Chris Flipse <cflipse@...> wrote:

>
>
> IE is a bit more ... forgiving of malformed (x)html
>
> What you're actually sending over the wire, before the browser gets to it,
> will look something like
>
> <tr><td>
> <form ....>
> </td>
> <td> form fields </td> etc
> <td>description <input type=submit></form></td>
> </tr>
>
> what to do: Move your <%= form_for %> tag to between the <tr> and the <td>,
> and the matching <% end %> to between the last </td> and </tr> tag in your
> loop. That should hopefully get you what you're looking for...
>
> <table>
> <tr><form><td></td>...<td></td></form></tr>
> </table>
>
> why?: tr, td and form are all "block" tags, and they need to be nested
> correctly -- opened and closed in the right order. Firefox's renderer will
> correct for this, closing the block when it sees that the containing
> element
> has been closed.
>
> - chris
>
> 2009/6/25 John Holland <jbholland@... <jbholland%40gmail.com>>
>
>
> > OK, I have been working on this some more and found something very
> strange:
> >
> > In IE it works and in Firefox it does not. It seems the code generated is
> > different in the two browsers, which I don't understand.
> >
> > I couldn't see how to get a parameter from my form into my controller via
> > Ajax.
> >
> > In Firefox the </form> tag is appearing before the rest of my form, but
> in
> > IE it is not.
> >
> > This code is really stupid, it's just a learning exercise - anyway this
> the
> > chunk causing the problem
> >
> > ================================================================
> > <table border="1">
> > <% @line_items.each do |line_item| %>
> > <tr><td>
> >
> >
> >
> > <% form_remote_tag :url => url_for( :controller => 'line_items',
> > :action => 'update_quantity_in_place' ,:id => line_item.id ) , :update
> > => "quan.#{line_item.id}" do %>
> >
> >
> > </td>
> >
> > <td><%=h line_item.id %></td>
> > <td id="quan.<%=h line_item.id %>"><%= line_item.quantity %></td>
> > <td><%= text_field_tag :quantity %></td>
> > <td><%=h line_item.description %> <%= submit_tag "update" %>
> > <% end %>
> > </td></tr>
> > <% end %>
> > </table>
> > ======================================================
> >
> > Am I doing something wrong here?
> >
> > John
> >
> >
> > > On Wed, Jun 24, 2009 at 2:56 PM, John
Holland<jbholland@...<jbholland%40gmail.com>
> >
> > wrote:
> > >> I'm trying to get something working using Rails and ajax. I'm using
> the
> > form_remote_tag to call a view/controller that does an ajax update. �,A
> The
> > thing I can't figure out is how I can pass into the ajax form a parameter
> > the user has put in a form field on the page? I need to get from the
> user's
> > input tag to the controller.
> > >
> > > Wouldn't the field information be in the params hash in the controller?
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>
> --
> // anything worth taking seriously is worth making fun of
> // http://blog.devcaffeine.com/
>
> [Non-text portions of this message have been removed]
>
>
>


[Non-text portions of this message have been removed]




Tue Jun 30, 2009 7:31 pm

jtotheh
Offline Offline
Send Email Send Email

Forward
Message #1825 of 1952 |
Expand Messages Author Sort by Date

Join Us for the 2009 RubyRX/AgileRX Tour coming to Reston on September 10-11th! RubyRX 2009 will be a co-located event with AgileRX. You get two great shows...
Jay Zimmerman
jz_tcpn
Offline Send Email
Jun 24, 2009
4:13 pm

I'm trying to get something working using Rails and ajax. I'm using the form_remote_tag to call a view/controller that does an ajax update. The thing I can't...
John Holland
jtotheh
Offline Send Email
Jun 24, 2009
8:09 pm

... Wouldn't the field information be in the params hash in the controller?...
David Medinets
medined
Offline Send Email
Jun 25, 2009
12:32 am

From: David Medinets <david.medinets@...> Subject: Re: [novarubygroup] basic rails ajax questions Date: Wed, 24 Jun 2009 20:31:11 -0400 OK, I have been...
John Holland
jtotheh
Offline Send Email
Jun 29, 2009
2:15 pm

IE is a bit more ... forgiving of malformed (x)html What you're actually sending over the wire, before the browser gets to it, will look something like ...
Chris Flipse
thegreyw0lf
Offline Send Email
Jun 30, 2009
1:24 pm

Thanks! ... [Non-text portions of this message have been removed]...
John Holland
jtotheh
Offline Send Email
Jun 30, 2009
5:15 pm

I tried what you said and it still behaved differently in Firefox and IE. But then I tried moving the form_for outside of the entire TABLE, at which point it...
John Holland
jtotheh
Offline Send Email
Jul 9, 2009
3:12 pm

John, Try moving the whole form into a td. Any time I have tried to interweave a table and a form I have been met with these types of issues. Get the Ajax...
Carl Fyffe
sixty4bit
Offline Send Email
Jul 9, 2009
3:40 pm

It's an (x)html issue at this point. FORM tags are allowed *inside* of table cells. Try putting the form for each row inside of the TD, and try to avoid...
Jonathan Julian
jonathanjulian
Online Now Send Email
Jul 18, 2009
4:51 pm

FYI... The HTML Validator plugin for Firefox is useful for situations like yours when developing sites: http://users.skynet.be/mgueury/mozilla/ I recommend...
Arild Shirazi
staticinnerc...
Offline Send Email
Jul 20, 2009
2:55 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help