سؤال

function send_xml_form_user_profile_form_alter(&$form, &$form_state){
    $form["#submit"][] = 'send_xml_edit_account_submit_function';
    drupal_set_message('<pre>' . print_r($form['#submit'], TRUE) . '</pre>');
}

function send_xml_edit_account_submit_function($form, &$form_state) {
    drupal_set_message(t("ahoy"));
}

the modules name is send_xml.module.

this code drupal_set_message('<pre>' . print_r($form['#submit'], TRUE) . '</pre>'); displays

Array
(
     [0] => user_profile_form_submit
     [1] => send_xml_edit_account_submit_function
)

but this code drupal_set_message(t("ahoy")); isnt displaying...

anyone ring a bell?

it's quite annoying to have problems which you cant find the reason why... does anyone experience this before? if yes, would please so kind to share your solutions to me. thank you very much! :)

هل كانت مفيدة؟

المحلول

There is no problem with the code you've pasted. I've tested it and it works fine ; I get "ahoy" displayed.

Suggestions:

  • Try it on a fresh Drupal installation.
  • Are there any validation callbacks that prevent the submit callback to be executed?

نصائح أخرى

For drupal 7 there are three arguments with form alter.

function hook_form_FORM_ID_alter(&$form, &$form_state, $form_id) {
  // your code
}

Hope this will work for you...

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top