Form post missing parameters for form elements

I’m having an issue where a form post does not contain the value of the
select box it contains. This problem happens after I update the the
select box using an observe_field triggered ajax call. The result of
the call is to call render :partial to re-generate just the select box
element. If I post before triggering the ajax request I get all the
correct parameters, afterwards, however I only get the commit, action
and controller parameters. I have already cleared the usual suspects,
forms improperly nested, etc.

If I have another element in the form but outside the partial that gets
re-rendered it’s value is submitted with the form. Along this line I
figured I could have an on_change event on my select box so when
someone selects a value it could get assigned to a hidden text field
outside the partial. The javascript for all this works and I can
verify the hidden text field has the correct value (using the Firebug
javascript console) but when the form submits I get the original
unmodified value of that hidden text field.

This is what my form looks like (the relevant parts that is). Yes I
know these multiply nested tables for layout are hideous and it has
caused me no end of grief on this project, however, I did not write
them and I have absolutely no control over the html at this point
(short of rewriting it all myself). The first form’s submit is not
relevant to this problem, just the org_id select box which triggers the
re-rendering of the partial inside the td with the userdata id. I have
tried making the target of the observe_field be a div, a span and a td
all with the same effect.

Here is the partial:

<%= select_tag “user_id”, options_for_select(@users),
:class=>‘broadcast’, :onchange=>“alert($(‘hiddenuser’).text);
$(‘hiddenuser’).text = $(‘user_id’).value; alert($(‘hiddenuser’).text)”
%>

Thanks in advance for any insights you can shed on this strange
problem.

David K.
Rising Tide Software

Organizations: <%= start_form_tag :action=>"edit" %> <%= end_form_tag %>
<%= select_tag "org_id", options_for_select(@orgs), :class=>'broadcast' %> <%= observe_field( :org_id, :url=>{:action=>'change_org'}, :update=>'userdata') %> <%= submit_tag "Edit", :class=>"inputsubmit" %>
   
Select User: <%= start_form_tag :controller=>"user", :action=>"modify" %> <%= text_field_tag "hiddenuser", "-1", :type=>"hidden" %> <%= end_form_tag %>
<%= render :partial=>"user_select" %> <%= submit_tag "Edit", :class=>"inputsubmit" %>

David K. wrote:

cellpadding=“0” cellspacing=“0”>
<%= start_form_tag :action=>“edit” %>

 ...OMITTED...
<%= end_form_tag %>

Try swapping the nesting of the form and the table.
In HTML you can have a form directly inside a

,
but not at a point at which a tbody or row tag is
expected.


We develop, watch us RoR, in numbers too big to ignore.