I have a form_tag
in my Rails app. When I click on the submit button, the form is re-rendered. I would like to stop the re-rendering and I would like to retain the original form with all the input fields even when the submit button is clicked.
How can I achieve this? Pls help!
<%= form_tag generate_report_path(:header => true) do |f| % >
<div class="container-fluid">
<div style="padding-right:10px">
<%= select_tag(:report_id, options_for_select(
[["Select Report Type", 0],
["Report1", 1],
["Report2", 2],
["Report3", 3]]), id: "report_selection") %>
<%= hidden_field_tag :format, :pdf %>
I have a select_tag
in my form as shown above which the user uses to select the report which he would like to generate (report1 or 2 or 3)
Based on the selection above, a different set of input controls would be displayed right below the select_tag dropdown
shown above.
When the user selects the values he likes on the input controls and then clicks on the submit button (labelled as "generate report"), this is what happens:
- all the input controls that were displayed right below the
select_tag dropdown
disappear leaving behind only theselect_tag dropdown
with the default selection (so that the user can once again select the report which he would like to generate)
How can I disable the above step and retain all the input controls (which were displayed below the select_tag dropdown
) even after the user clicks the submit button?
Pls help!