06 Oct 2010, 16:58
Generic-user-small

Jacques E Fournier (1 post)

I have followed the instructions in Chapter 13 of Advanced Rails Recipes. However, one of the fields for my nested model uses scriptaculous’ autocompleter.local. The drop down shows up for the first record in the nested model, but doesn’t show up for the others after I click the “Add” button. Any ideas? Here is my code: ` <%= building_form.text_field :primary_type_id %> <%= building_form.text_field :primary_type_name, :size => “50”, :onkeypress => “return event.keyCode == Event.KEY_RETURN ? false : true” %>

	      <div class="auto_complete" id='building_primary_type_auto_complete'></div>
	      <script type="text/javascript">
		//<![CDATA[
		var building_primary_type_auto_completer = new Autocompleter.Local(
			'rent_comparable_new_building_attributes__primary_type_name',
			'building_primary_type_auto_complete',
			primary_type_names_spaces,
			{
				minChars:-1,
				frequency: 0.01,
				choices: 100,
				partialSearch: true,
				partialChars: 1,
				fullSearch: true
			}
		)
		//]]>
	      </script> `
  You must be logged in to comment