0

I have the follwoing form in my view :

I have an instance variable @selected_folder somewhere above in this view

<%= form_for :workflow_selection, :remote => true, :method => "get", :url => {:action => "final_submission"} do |f| %>  

            <p> Check the workflows needed and then click on the button with folder name</p>

            <% @workflow_map[@selected_folder].each do |i| %> 

            <p><%= f.check_box(i)%> <%= f.label(i, i)%><br /><p>
            <% end %>

            <br />
            <p><%= f.submit @selected_folder%></p> 
            <% end %>

I want to label the submit button as just 'submit' and should still be able to pass the @selected_folder instance variable to the final_submission action mentioned in the form_for tag

I tried various option like

<%= form_for :workflow_selection, :remote => true, :method => "get", :selected_folder => @selected_folder
    :url => {:action => "final_submission"} do |f| %>  

i tried to create a select drop down and hide it from view but still trying it to pass once the submit button is clicked.

and some more options..

None of them worked

Please help.

1 Answer 1

2

If you want to pass @selected_folder along in the form submission, you can add a hidden_field_tag.

As per Rails documentation:

hidden_field_tag(name, value = nil, options = {})

So in your case

<%= hidden_field_tag 'selected_folder', @selected_folder %>

in the workflow_selection, selected_folder will be present in the form hash.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot. I have been trying this from last two days.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.