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 functionality working outside of the table first, and
then troubleshoot the crossbrowser issues after you have that working.
One problem at a time.
Carl
On 6/30/09, John Holland <jbholland@...> wrote:
> 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]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>