-1

In my drupal commerce checkout page form function, I have created a radio list:

$form['accounts'] = array(
    '#type' => 'radios',
    '#title' => 'Please chose from the following options',
    '#options' => $options,
  );

and it does create the radio button list.

I then put some code in to the submit function to redirect if I chose option 0:

function subscription_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {
  dpm($form_state['values']);
  //$selection = var_dump($form_state['values']['accounts'], true);
  //watchdog('subscription', $selection);
  var_dump($form_state['values'], true);
  if($form_state['values']['accounts'] == 0) {  //if the user clicked 'none', go immediately to the review page
    $order = commerce_order_status_update($order, 'checkout_review', FALSE, TRUE, t('User is not any of the current accounts, proceed to review page'));
    drupal_goto('checkout/' . $order->order_id . '/review');
  }
}

but its always directing me to the review page, instead of moving to the next custom page (which definitely exists and is accessable, because you can reach if with the 'go back button' on the review page). I tried viewing the $form_state['values'] but couldn't figure out how to do it properly

Also, when I tried using '0' instead of 0 in my if statement, then clicking next button kept me on the same page.

0

I figured it out. The issue is that the value I was trying to reach is really at

$form_state['values']['email_verification']['accounts']
where 'email_verification' is the name of the checkout page the submit button is on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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