I'm trying to implement a detailed search form (on top of the apachesolr project). I decided to build the form using the Forms API, as it seems the way to "do it" in Drupal.
I get the values from the form in the submit handler just fine, I can fire my search request and get the results.
But when I display the page (and the form with it) again, the search form is empty. This is not entirely what I want, as I would like the user to refine their search.
I tried multiple ways to keep the values in the form, and after quite some googling, form_state['storage'] seem the way to go - to fill it with the value there, and use those in form method to fill in the default values. The problem is, that storage always is empty when I get the second time in the form function, and I have no real clue what I'm missing here.
The relevant code here is:
$items = array();
$items["name"] = array(
"#type" => "textfield",
"#title" => t("Name"),
"#default_value" => isset($form_state["storage"]["name"]) ? $form_state["storage"]["name"] : "",
$items["submit"] = array(
"#type" => "submit",
"#value" => t("Search"),
$name = $form_state["name"]["#value"];
$form_state["storage"]["name"] = $name;
$form_state["rebuild"] = true;
// Do search here
I hope someone can help me here :)