I currently have the interface working, but not the submission.
Code:
<% form_tag do %>
<%= select (:project, :status, @status_options, {:include_blank => nil},{:onchange => " if(this.value.match(/option1/i)){
$('option1').show(); } else {
$('option1').hide(); }
if(this.value.match(/option2/i)){
$('option2').show(); } else {
$('option2').hide(); } "})%>
My DIVs:
Code:
<div id = "option1" style = "display: none">
<% form_tag do %>
<%= select (:project, :probability, @status_option1) %>
<% end %>
</div>
<div id = "option2" style = "display: none">
<% form_tag do %>
<%= select (:project, :probability, @status_option2) %>
<% end %>
</div>
And my global "choices" from ApplicationContoller:
Code:
@status_option1 = [["Probability",nil],["High (70%)",0.7],["Medium (50%)",0.5],["Low (30%)",0.3]]
@status_option2 = [["Probability",nil],["High (50%)",0.5],["Medium (20%)",0.2],["Low (10%)",0.1]]
I couldn't get "else-if" to work, so I was rather crude. If anyone sees an obvious reason why the probability variable isn't being submitted, let me know. Thanks
Bookmarks