I'm making a tool for my university that allows students to create a list of classes by doing the following:
Searching by course title for their course via an autocomplete input field.
Adding that course to a separate form that upon being submitted creates a course list.
I am trying to link the autocomplete and the course list form with an 'add to course list' button that inserts a hidden input field into the course list form which can subsequently be submitted by a 'create course list' button.
My question is this: How do I take the value of the autocomplete input and insert it into the course list form without using AJAX?
So far I have something like the following:
<%= text_field_with_auto_complete :course, :title, :size => 40 %>
<%= link_to_function "Add to Course List" do |page|
page.insert_html :top, :course_list, hidden_field(:courses, :course,
{:value => "$('course_title').value"}) %>
<% form_for(@course_list) do |f|%>
<div id="course_list">Insert selected courses here.</div>
<% end %>