Hello! Is there a way i can pass extra variables/items into drupal_get_form('user_register');? there are some values that are needed to be there with input type hidden.

Comments

mitchmac’s picture

http://api.drupal.org/api/function/drupal_get_form/6 states that additional arguments get passed to the form constructor.

example:

drupal_get_form('form_id', $x, $y, $z);

$x, $y, $z get passed to the function that creates the form.

cachobong’s picture

Hi! Thanks for the reply. My next question is how do i assign $x, $y or $z to a field in my Form?

thanks!

cachobong’s picture

scrap that..follow up question i have the function

function my_hook_form_user_register_alter(&$form, $sh_help, $sh_title) {
	$form['user_registration_help']['#value'] = t($sh_help);
}

it is called by:

print drupal_get_form('user_register', $fields['help']->content, $fields['title']->content);

but it keeps on displaying:

warning: Missing argument 3 for my_hook_form_user_register_alter() ...

What's wrong?

cachobong’s picture

bump!

nevets’s picture

The declaration of your function should be

function my_hook_form_user_register_alter(&$form, &$form_state) {

Only the original form function gets the extra parameters.

cachobong’s picture

so how do i get the extra parameters?

func_get_args()?

nevets’s picture

What are you actually trying to do?

cachobong’s picture

pass extra parameters into the alter form..:)