I have tabular format data and each row I have an edit and delete links , on clicking on the delete link it should ask for a confirmation to delete and if press delete only I need to delete. Now its asking for confirmation but not deleting any. Instead its giving me a blank page. Is it because it's submitted to the same function? It's not going to the products_delete_confirm_submit()
on submission by the way. Or is there any workaround for this?
Here is the try :
Menu call back:
function mailusers_menu() {
$items['mailusers/usergroup/delete'] = array(
'title' => 'Delete User group',
'page callback' => 'drupal_get_form',
'page arguments' => array('products_delete_confirm', 3),
'type' => MENU_CALLBACK,
'access callback' => TRUE,
'access arguments' => array('access admin tab'),
);
return $items;
}
callback function
function products_delete_confirm($form,$product_code) {
$form['_product'] = array(
'#type' => 'value',
'#value' => $product_code,);
//$form['#action'] = url("mailusers/products_delete_confirm_submit");
// //drupal_set_message($product_code);
return confirm_form($form,t('Are you sure you want to delete '.$product_code.' Product?'),
isset($_GET['destination']) ? $_GET['destination'] : "mailusers",t('This action cannot be undone.'),t('Delete'),t('Cancel'));
}
Delete submit handler:
function products_delete_confirm_submit($form, &$form_state) {
$form_values = $form_state['values'];
if ($form_state['values']['confirm']) {
$param = $form_state['values']['_product'];
drupal_set_message(t('Product ' .$param.' will get deleted.'));
db_query('DELETE FROM {content_type_usergroup} WHERE vid = %d', $param);
drupal_set_message(t('usergroup has been deleted.'));
drupal_goto('mailusers');
}
}
And in the table I am calling the delete link href="mailusers/usergroup/delete/10"