Hi people,
my issue is about form-api, I have seen people that declared a second form button, adding a submit function to handle and process the form input, after that you can use form_state["redirect"] to send the form via goto (a new GET) to the page you want...
my question is: can you process in a function the POST values of the form and directly show the results, that is interrupting the normal flow of the form?
the concrete example is this:
I did a new search tab via hook_search for my custom type that delegates normal search in node_search restringing results to type "vehicle" as you can see...
function vehicle_search($op = 'search', $keys = null) {
switch ($op) {
case 'name':
if (user_access('access content')) return t('Vehicles');
break;
case 'search':
return node_search('search', 'type:vehicle '.$keys);
}
}
but... altered the form in the way node module does to add "Advanced Search" for example imagine... a select with gasoline/diesel, and a new button: "advanced search" with a handler
in this handler what I'd like to do is:
-get the value of "combustible" select
-make a simple query
-show the results
but the reality is I cannot because I have as options...
-redirect=FALSE: form reloads but I simply altered so I cannot react to show different things
-redirect=my_vehicle_results_page: I'd need to pass via get the value for combustible
I cannot see any more options...
Help please!!!
Juan Arias
Spain
Comments
submit handler should break the flow
One way to do it would be to have your submission handling function break the flow. So instead of trying to mess with the redirect in fapi, just process your variables, print them, and exit before it can redirect.
The theme function will act as a wrapper to output the normal page template and put as the contents of the page what's in $return. The exit will just stop any further execution (like a redirect).