I
Igor Anic
Is there a way in rails to choose controller action to which form will
be submitted?
Currently I have something like this:
VIEW:
<%= start_form_tagaction => 'action_chooser', :id => @id %>
....
<%= hidden_field_tag("action_type") %>
<%= link_to_function "action1",
"document.frm.action_type.value='action1'; document.frm.submit()" %> <br>
<%= link_to_function "action2",
"document.frm.action_type.value='action2'; document.frm.submit()" %> <br>
CONTROLLER:
def action_chooser
case action_type
when 'action1'
...
when 'action2'
I would like to have action1 and action2 functions in controller and
somehow choose on the client where to submit.
Thanks,
Igor.
be submitted?
Currently I have something like this:
VIEW:
<%= start_form_tagaction => 'action_chooser', :id => @id %>
....
<%= hidden_field_tag("action_type") %>
<%= link_to_function "action1",
"document.frm.action_type.value='action1'; document.frm.submit()" %> <br>
<%= link_to_function "action2",
"document.frm.action_type.value='action2'; document.frm.submit()" %> <br>
CONTROLLER:
def action_chooser
case action_type
when 'action1'
...
when 'action2'
I would like to have action1 and action2 functions in controller and
somehow choose on the client where to submit.
Thanks,
Igor.