Или это без использования javascript (и замены eregi () на preg_match () ...
if ( $form['#theme'] == 'confirm_form' ) {
$no = $form['actions']['cancel']['#value'];
if (!is_null($no)) {
// Get the text to put on the cancel button
$value = preg_replace('/(<\/?)(\w+)([^>]*>)/e', '', $no);
preg_match('/href\s*=\s*\"([^\"]+)\"/', $no, $href);
$form['actions']['cancel']['#value'] = '';
$form['href']=array(
'#type'=>'value',
'#value'=>$href[1],
);
// Add our own button
$form['actions']['docancel'] = array(
'#type' => 'submit',
'#name' => 'cancel',
'#submit' => array('mymodule_confirm_form_cancel'),
'#value' => $value,
);
}
}
и
function mymodule_confirm_form_cancel(&$form,&$form_state) {
$href=$form['href']['#value'];
if ( !is_null($href) ) {
$form['#redirect']=$href;
}
}