[development] How to interrupt/redirect Search submit to auth/validate (via Captcha) *BEFORE* actual submit to search engine & display of results?

Ben DJ bendj095124367913213465 at gmail.com
Sun May 16 02:42:54 UTC 2010


On Sat, May 15, 2010 at 7:00 PM, Ben DJ
<bendj095124367913213465 at gmail.com> wrote:
> That does not seem Drupal-esque to me.  I'm guessing that the current
> best approach is to 'somehow' grab & use FormAPI ...
> Finding a method recommendation, and docs to go with it, has beeen a
> challenge -- so far.

One approach that seems to me to hold some promise, or at least pieces
of it, is described here

  "Redirecting Users After Submitting a Form in Drupal 5 and 6"
   http://drupal.org/node/134000#comment-1556764

wherein,

...
In Drupal 6, one method is:

Create a custom module custom.module and place this code in it:
function custom_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {
    case 'contact_mail_page':
        $form['#redirect'] = 'thank-you-page';
      break;
  }
}
...

Looking in ./modules/search/search.module, i see,

...
/**
 * Process a block search form submission.
 */
function search_box_form_submit($form, &$form_state) {
...
  $form_id = $form['form_id']['#value'];
  $form_state['redirect'] = 'search/node/'.
trim($form_state['values'][$form_id]);
}
...

which refers to the 'redirect'.

Right approach with the right pieces?  If so, unclear -- atm -- how
they fit together.

Ben


More information about the development mailing list