struggling with template_preprocess in module I know there is a lot of documentation on this function on google, but I am still not able to get this hook to run for my holidayautosxml_carsearch_form. Could anyone advise on what I am doing wrong.

The Theme function is running fine. If I put exit(); in that function I get white screen of death. However if I put exit(); in the template_preprocess function nothing happens.

I have cleared all the caches.

my template is called holidayautosxml-carsearch.tpl.php and it is located in the module folder.

Here is my theme function

function holidayautosxml_theme(){
return array(
            'holidayautosxml_carsearch' =&gt; array(
                    'template'=&gt;'holidayautosxml-carsearch',
                    'render element'=&gt;'form',
            ),

    'halocationresults' =&gt; array(
        'template' =&gt; 'halocationresults',
        'variables' =&gt; array('haresults' =&gt; NULL,),
    ),
    'hapriceslist' =&gt; array(
        'template' =&gt; 'hapriceslist',
        'variables' =&gt; array('haprices' =&gt; NULL,),
    ),
);
}


Here is my template_preprocess function

function template_preprocess_holidayautosxml_carsearch(&amp;$variables){

$variables['holidayautosxml_carsearch'] = array();
$hidden = array();
//Provide variabels named after the form keys so themers can print each element independently.
foreach (element_children($variables['form']) as $key){
    $type = $variables['form'][$key]['#type'];
    if ($type == 'hidden' || $type == 'token'){
        $hidden[] = drupal_render($variables['form'][$key]);
    }
    else{
        $variables['holidayautosxml_carsearch'][$key] = drupal_render($variables['form'][$key]);
    }
}
//Hidden form elements have no value to Themers. no need for seperation.
$variables['holidayautosxml_carsearch']['hidden'] = implode($hidden);
//collect all form elementsto make it easier to print the whole form
$variables['holidayautosxml_carsearch'] = implode($variables['holidayautosxml_carsearch']);
}


and here is my form function

function holidayautosxml_carsearch_form($node, &amp;$form_state){

    $country_list = _get_country_list();
    $form['country'] = array(
            '#type'=&gt;'select',
            '#title'=&gt;'Select Country',
            //'#description'=&gt;'Select the country where you want to collect the car',
            '#options'=&gt;$country_list,
            '#ajax' =&gt; array(
                'callback' =&gt; 'update_officename_autocomplete',
                'wrapper' =&gt; 'haofficename',
            ),
    );

    $citylist = _get_city_list($form_state['values']['country']);

$form['officename'] = array(
    '#type'=&gt;'select',
    '#title'=&gt; t('Location'),
    //'#description' =&gt; t('Select the location where you want to pick up the car'),
    '#required' =&gt; TRUE,
            '#options' =&gt; $citylist,
            '#width' =&gt; 50,
            //'#autocomplete_path'=&gt;'location-autocomplete',
            '#prefix' =&gt; '&lt;div id="haofficename"&gt;',
            '#suffix' =&gt; '&lt;/div&gt;',
);


    if (!empty($form_state['values']['country'])){
        $form['officename']['#autocomplete_path'] = 'location-autocomplete/' . "{$form_state['values']['country']}";
    }
    $dateformat = 'd-m-Y H:i';
    $form['datefrom'] = array(
        '#required'=&gt;TRUE,
        '#type'=&gt;'date_popup',
        '#date_format'=&gt;$dateformat,
        '#title'=&gt;t("Pickup date"),
        //'#description'=&gt;t("The date you are picking up the car"),

        );

    $form['dateto'] = array(
        '#required'=&gt;TRUE,
        '#type'=&gt;'date_popup',
        '#date_format'=&gt;$dateformat,
        '#title'=&gt;t("Dropoff date"),
        //'#description'=&gt;t("The date you are bringing the car back"),
    );

$form['submit'] = array(
'#type'=&gt;'submit',
'#value'=&gt;'Search Now',
'#submit'=&gt;array('holidayautosxml_carsearch_form_submit'),
);

return $form;
}
I think it should be  holidayautosxml_preprocess_holidayautosxml_carsearch(&amp;$variables).
Basically the syntax is [yourModuleName|yourThemeName]_preprocess_[themeFunctionName](&amp;$variables).

Also you need to flush your cache after you make the change.