Hi all,
I have a little bit problem with my code here.
basically, i want to have a drop down list, and if i select one value
of the drop down list,
the value of the text field that i have will change its value.
what i have done is to use observe field to dynamically update my text
field.
however, when i am pressing the submit button, it doesnt want to read
the value of the text field.
anyone knows what happen?
here is my code:
chapter controllers:
def upload
@chapter = Chapter.new
@uploads = Book.find(:all)
def get_chapter_number
@books= Book.find(:first,
:conditions => ["title = ?",
params["title"]])
render :layout => false
end
end
views for upload:
<%= javascript_include_tag "prototype" %>
<% form_for (:chapter, @chapter, :url=>{:action =>
"uploadFile"}, :html => {:multipart => true}) do |f| -%>
<label class="required">series title:</label>
<select name="upload[title]"
id="upload[title]">
<% @uploads.each do |upload| %>
<option value="<%= upload.title %>">
<%= upload.title %>
</option>
<% end %>
</select>
<label class="required"> chapter: </label>
<div id="chapter_container">
</div>
<%= observe_field("upload
[title]", :update=>"chapter_container", :url=>{:action
=>
"get_chapter_number"}, :with => ''title'',
:on=>"changed") %>
<%= submit_tag ''Upload'', :class =>
"submit" %>
views for get_chapter_number:
<input type="text" id="upload_number_of_chapters"
name="upload
[number_of_chapters]" value= <%= @books.number_of_chapters + 1 %>
size
= "30" />
that code works fine.. if i select the value of the drop down list, it
will dynamically update the text field.
however, when i press the submit button, it doesnt read the value of
the text field that being updated.
any suggestion or help?
thanks in advance,
prawira
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---