Welcome Guest, Not a member yet? Register   Sign In
Jquery Confirm
#1

[eluser]Wonder Woman[/eluser]
I have got a delete confirm set up on my site but I can't get my controller to determine what button was clicked because I have had to change my submit to buttons for the jquery to work so the controller can't pick up which button was clicked but it could when it was a submit Undecided

If you could help me I would be most grateful, thanks.

View:

Code:
form_submit('submit', 'Delete', 'class="confirm_delete"')

Javascript (there is more to this but this is the main part):

Code:
$('.yes').bind('click', function(){
   $('form#entries').submit();
});

Controller:
Code:
if($this->input->post('submit') == 'Delete') {
   // do the delete
}
#2

[eluser]Wonder Woman[/eluser]
Hi everyone, does no-one have any idea on how I can fix this please? I'm totally stuck Sad I will reward you with a very kind thank you Big Grin
#3

[eluser]andyy[/eluser]
Can you post a link to the actual site? Or include the all html for the form, and all the code of the javascript calls.

If you can do this, I should be able to help Smile
#4

[eluser]vitoco[/eluser]
I've found a not very elegant solution :

1.- make a hidden input name "action_input"
2.- add event handlers to the buttons

Code:
$('#button_delete,#button_other_case').click( function(e)
    {
        $('#action_input').attr('value',$(this).attr('id'));
    });
3.- in the controller, ask for the value of $_POST['action_input']

this works cause the "click" event occurs before de submition of the form

Saludos




Theme © iAndrew 2016 - Forum software by © MyBB