ive got this code

function send_xml_form_user_register_form_alter(&$form, &$form_state) {
	$form['#submit'][] = 'send_xml_submit_function';
}

function send_xml_submit_function($form, &$form_state){
	$string = "alkasklsalksa";
	drupal_set_message(t('edit = %string.', array('%string' => $string)), "status");
}

my module name is send_xml, i just want to know if the after registration it will go in the function, so i just used drupal-set_message to output the sample message string... but it is not displaying what did i miss ? any help please...

thank you in advance,, i had a lot of tabs now searching what's the problem...

Comments

ujwalchowdary’s picture

Please check once whether send_xml module is enabled or not.

joshi.rohit100’s picture

Check if module is enabled or not , also check after clearing cache as new hook will not effect if cache is not cleared after implement.

kmlinantud’s picture

thanks for your responses! :)

the module is running fine.

the problem is in because i use the registration form in colorbox. and it does not display the message. maybe some complications. but if i go to the url `mywebsite/custom_registration_link/` its running fine now.

ive got new problem though.

in the custom_submit_handler, ive got

$email = $form_state['values']['mail'];
$password = $form_state['values']['pass'];
$form_state['redirect'] = array(
	'myurl',
	array(
		'query' => array(
			'email' => $email,
			'password' => $password,
		),
	),
);

i want to redirect to `myurl` with some parameters, ive been searching for quite 3 days and i came up unto this code. the problem is it is not redirecting to `myurl`

thank you again for your future responses,

ujwalchowdary’s picture

 $email = $form_state['values']['mail'];
 $password = $form_state['values']['pass'];
 $query = array('email' => $email,'password'=>$password);
 drupal_goto('url',$query);
kmlinantud’s picture

that was quick reply.. :) thanks.

though.

i used this already, and it is not working.. AAND i've searched for quite a while and i found out the it is not good to put drupal_goto in your custom_submit_handler, because there still might be other actions after the submit that might break. so they said to use $form_state['redirect'] instead..

ujwalchowdary’s picture

yes, drupal_goto() is not good to use in forms.

Try drupal_redirect_form($form_state);

kmlinantud’s picture

i will call drupal_redirect_form($form_state); inside my custom_submit handler after setting $form['redirect'] ?

ujwalchowdary’s picture

yes

kmlinantud’s picture

still not good. ain't redirecting at all. but the page refreshes, i put a drupal_set_message just to see if it is going in my function, and yes it is but ain't redirecting.

aargh, it is so hard to debug..

ujwalchowdary’s picture

try the following code and do clear cache

function send_xml_form_user_register_form_alter(&$form, &$form_state) {
	$form['#submit'][] = 'send_xml_submit_function';
}

function send_xml_submit_function($form, &$form_state){
	$email = $form_state['values']['mail'];
	$password = $form_state['values']['pass'];
	$form_state['redirect'] = array('admin/people',array('query' => array('email' => $email,'password' => $password)));
}
kmlinantud’s picture

the difference in our code is the commas at the end... do you think that's the reason?

ill try your code.. ill be back to say if it worked.. big thanks!!

P.S. i clear my cache everytime i chage any code in my module just to make sure. :)

ujwalchowdary’s picture

the last comma is causing problem

kmlinantud’s picture

@Ujwal P

still not working.. how can i debug this? is there a way to debug? to see what is running, what is not?

ujwalchowdary’s picture

Using colorbox ?

kmlinantud’s picture

colorbox, like a lightbox, a simple module that will have a popup effect :)

https://drupal.org/project/colorbox

i dont use it anymore, i just go to the registration page myself. then register.

ujwalchowdary’s picture

kmlinantud’s picture

i liked to use that sooner or later after this redirection works.. haha :)