Re: [Rails] Re: Problem with drop down in form
On 28 September 2011 18:40, Di Zou <lists@ruby-forum.com> wrote:
> ...
> This is what my form looks like now:
>
> <table>
> <thead>
> <tr>
> <th><%= "Active Carrier" %></th>
> <th><%= "" %></th>
> <th><%= "Country" %></th>
> </tr>
> </thead>
> <tbody>
> <%= form_tag :action => 'update', :id => params[:id] %>
As I mentioned before it is not legal html to have a form in a table
like this. Try copying the complete html of the page (View > Page
Source or similar in your browser) and paste it into the w3c html
validator. This means that even though it may appear to work ok you
are relying on the browser attempting the make the best of a bad job
and different browsers may display your page differently. In
addition, even if you test it with all known browsers the next release
of a browser may do something different.
Colin
> <% for @carrier in @carriers %>
> <% fields_for "carrier[]" do |f| %>
> <tr>
> <td class="tn"><%= f.text_field :name, :readonly => true
> %></td>
> <td class="tn"><%= f.hidden_field :id %></td>
> <td class="tn"><%= f.select :country, @countries %></td>
> </tr>
> <% end %>
> <% end %>
> </tbody>
> </table>
> <%= submit_tag 'Update' %>
> <%= end_form_tag %>
>
> If I make a selection in the drop down list and I click "Update", this
> is what my request_parameters look like:
>
> request_parameters: {"commit"=>"Update",
> "action"=>"update",
> "carrier"=>
> {"6"=>{"name"=>"Sprint Nextel", "country"=>"USA", "id"=>"6"},
> "7"=>{"name"=>"Verizon", "country"=>"USA", "id"=>"7"},
> "2"=>{"name"=>"T-Mobile US", "country"=>"UK", "id"=>"2"},
> "4"=>{"name"=>"AT&T", "country"=>"USA", "id"=>"4"},
> "5"=>{"name"=>"Sprint Nextel", "country"=>"USA", "id"=>"5"}},
> "controller"=>"active_carriers"}
>
> How do I take the data in the request_parameters and update each row in
> my database? Thanks.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home