Hi,
I'm trying to port a module (called Evaluation) from drupal 4.7.x to drupal 5.x an I have some problems to get the forms work correctly.
The following code shows one of my forms and it's validation:
<?php
// Build the whole form with all elements
function evaluation_admin_roles_or_user_form() {
$form = array();
$form['#pre_render'] = array('evaluation_pre_render'); // set the pre_render function
$form['users'] = evaluation_select_user(); // the input field
// ...
// build the whole form with all elements
// ...
return $form;
}
// create the input field for the username
function evaluation_select_user() {
$form = array(
'#type' => 'textfield',
'#title' => t('Select user'),
'#maxlength' => 60,
'#autocomplete_path' => 'evaluation/autocomplete',
'#description' => t('The user to which the selected questions should be assigned.'),
);
return $form;
}
// callback for the hook_menu()
function evaluation_admin_roles_or_user() {
drupal_set_title(t('Assign questions'));
// The $_GET variable is always empty
return drupal_get_form('evaluation_admin_roles_or_user_form', $form);
}
}
function evaluation_pre_render($form_id, &$form, $next_page = TRUE) {
global $form_values;
// ****************************************
// form_values is always empty here!