Topic: RJS: Null value problem


I'm trying to get the "Creating Variable Number of Models in One Form"-tutorial on this page to wok, but I have some trubble with RJS. I have looked 10 times and even copy the code from the tutorial, but I don't get it to work.

My code is:

  def new
    @agent =
  def add_order
    @order =

<%= error_messages_for 'agent' %>

<% form_for :agent, :url => { :action => 'create' } do |f| %>

    <p><label for="agent_costumer"><b>Kundnummer</b></label><br/>

Last edited by Dazen (2007-08-14 09:44:10)

Are you happy now?

Re: RJS: Null value problem

there is no id "add_order_link" to replace the add_order link. add a div around it with the proper id:

<div id="add_order_link">
<%= render :partial => 'add_order_link', :locals => { :index => @agent.orders.size } %>

also, i think i have read somehwere, to use page.replace_html rather than page.replace, as the latter somehow chokes in IE6 or 7