0

I installed Basic Cart module and I needed to completely modify its submission handler. So I used the following code:

function THEME_form_alter(&$form, &$form_state, $form_id){
    if($form_id == 'order_node_form'){
        $form['#submit'] = array("my_form_order_submit_handler");
    }
}

and It works perfectly. The order_node_form form has some values in its inputs and I need to get them. I don't know how to get the values from the $form variable so I need to kpr this variable. This is the my_form_order_submit_handler function:

function my_form_order_submit_handler($form, &$form_state) {
    kpr(1);
}

The problem is it doesn't kpr the 1 and is redirected to some where else. In the question kpr() in my form validation and submit function is not being called it has been suggested to add the following codes in form alter function and tried this code:

function THEME_form_alter(&$form, &$form_state, $form_id){
    if($form_id == 'order_node_form'){
        $form['#submit'] = array("my_form_order_submit_handler");
        $form_state['rebuild'] = TRUE;
        $form_state['no_redirect'] = TRUE;
        $form_state['redirect'] = FALSE;
    }
}

But it is still redirected and I can't see the kpr(1) result in the submission function. How can I prevent the page being redirected to some where else after the my_form_order_submit_handler function?

Thanks

1 Answer 1

1

You can call die() after kpr().

2
  • 2
    OR exit; after kpr() Commented Apr 29, 2018 at 13:46
  • 2
    Or learn to use a debugger...
    – Clive
    Commented May 3, 2018 at 17:34

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.