I have the following code in my view located in “\app\views\deployment_group” named make_deployment_group.html.erb
<%= form_for :folder_name, :remote => true, :method => "get", :url => {:action => "show_workflow_list"} do |f| %>
<%= f.select :foldernames, options_for_select(@folders, @folders.first)%><br /><br />
<%= hidden_field_tag 'selected_domain', params[:domain_selected] %>
<%= hidden_field_tag 'user_name', params[:username] %>
<pre><%= f.submit "Submit"%></pre>
<% end%>and my `js.erb` file for the action
show_workflow_list.js.erb: located at “\app\views\deployment_group” as show_workflow_list.js.erb
$('#workflow_selection').html("<%=j render "show_workflow_list" %>");
My application.html.erb file:
<!DOCTYPE html>
<html>
<head>
<title>Authorize</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
Now i want to remove the submit button and render the show_workflow_list partial in the <div> tag on my view whenever there is a change in the drop down. of folders.
Please help,
Thanks
You must to do this in JQuery. In a js file your must have something like this, in your app/assets/application.js, when the document is ready :
Or this, if you use coffeescript :
It will works. It’s unobostructive javascript! It will submit the form when you change the select, call your action in your controller in a ajax function and execute the content in your js.erb file.