Welcome Guest, Not a member yet? Register   Sign In
2 buttons in a form?
#1

[eluser]NateL[/eluser]
Tell me if this is possible...

We have a form with lots of checkboxes.

A user can select all of those checkboxes, and then click one of two buttons... Modify or Delete

the dilemma is the action of a form is only to ONE controller/method....sooo.... ??
#2

[eluser]David Johansson[/eluser]
i think you can have something like this:

Code:
echo form_submit('action', 'Modify');
echo form_submit('action', 'Delete');

and then on the receiving page you test if $this->input->post('action') equals 'Modify' or 'Delete'.
#3

[eluser]NateL[/eluser]
so essentially, my controller would have a "decision maker" method?

Can I forward the post data from the deciding method onto a different method that processes that data?
#4

[eluser]David Johansson[/eluser]
You could make one method wich first checks the submitted value and if it's Delete you go to the method _do_delete() (or whatever) otherwise to _do_modify()...

You don't need to forward the post data since it is availible in all of you controller's methods. if you call another method you can still call the $this->input->post method.
#5

[eluser]NateL[/eluser]
Alright thanks. I'll give that a shot Smile




Theme © iAndrew 2016 - Forum software by © MyBB