Specify a controller action via attribute in INPUT tag?


#1

I have a pre-existing form with one existing “SUBMIT” tag generated by
<%= submit_tag %>

I would like to add another <INPUT type=“submit” …> to my form.

How do I successfully associate that tag with a different
controller action than the default one specified by my <%=
start_form_tag %>?

Or does this approach even make sense?

In RoR, is it implied that an entire form is bound to a controller
action?

Thanks,
Wes


#2

Hi,
In the controller you must create an action that put in input your
submits; you must control the “@params[:commit]” value to understand
what is the button pushed. Once that you understand it, you must
redirect the control to the right action with:

action_name
render :action=> ‘action_name’

Wes G. wrote:

I have a pre-existing form with one existing “SUBMIT” tag generated by
<%= submit_tag %>

I would like to add another <INPUT type=“submit” …> to my form.

How do I successfully associate that tag with a different
controller action than the default one specified by my <%=
start_form_tag %>?

Or does this approach even make sense?

In RoR, is it implied that an entire form is bound to a controller
action?

Thanks,
Wes


#3

OK, so basically if I want one form that “maps” to multiple actions then
I have to have my form post to a “mini-controller” that figures out
which action to call?

Wes

Ivan M. wrote:

Hi,
In the controller you must create an action that put in input your
submits; you must control the “@params[:commit]” value to understand
what is the button pushed. Once that you understand it, you must
redirect the control to the right action with:

action_name
render :action=> ‘action_name’

Wes G. wrote:

I have a pre-existing form with one existing “SUBMIT” tag generated by
<%= submit_tag %>

I would like to add another <INPUT type=“submit” …> to my form.

How do I successfully associate that tag with a different
controller action than the default one specified by my <%=
start_form_tag %>?

Or does this approach even make sense?

In RoR, is it implied that an entire form is bound to a controller
action?

Thanks,
Wes


#4

I would think a min controller would only be necessary if you had a lot
of different actions you wanted carried out from your form.

For example, I have a form with ‘Save’ and ‘Save and go to next’
buttons. My save action updates the record and then based on the value
of @params[:commit] either redisplays the same page or re-directs to the
edit form for the next record.

William

Wes G. wrote:

OK, so basically if I want one form that “maps” to multiple actions then
I have to have my form post to a “mini-controller” that figures out
which action to call?

Wes

Ivan M. wrote:

Hi,
In the controller you must create an action that put in input your
submits; you must control the “@params[:commit]” value to understand
what is the button pushed. Once that you understand it, you must
redirect the control to the right action with:

action_name
render :action=> ‘action_name’

Wes G. wrote:

I have a pre-existing form with one existing “SUBMIT” tag generated by
<%= submit_tag %>

I would like to add another <INPUT type=“submit” …> to my form.

How do I successfully associate that tag with a different
controller action than the default one specified by my <%=
start_form_tag %>?

Or does this approach even make sense?

In RoR, is it implied that an entire form is bound to a controller
action?

Thanks,
Wes