3

I want to create a simple form to redirect the visitors to a relative path they enter.

I created a search page with views and it has lots of exposed filters. I don't want to use this exposed filter as block.

On the main page I want to show only a simple search form and if the user enter a word then submit search button, it should redirect the user to example.com/advanced-search?full_text=word.

enter image description here

How can I do that?

2

Have a look at the Rules Forms Support module. Some more details about it (from its project page):

Rules Forms Support provides a Rules based method for controlling forms and their elements. The module can be used to alter any form provided by Drupal core or contributed modules. Change element titles, descriptions, weights, and more, or validate form data and set form errors. Rules forms saves time and cost by affording site builders the ability to monitor and alter forms without the need to implement a custom module.

For help getting started with Rules Forms Support, please see the module documentation.

Features

  • Activate events for form creation, validation, and submission on a form-by-form basis.
  • Target individual form elements or the entire form in conditions and actions.
  • Manipulate the attributes of a form element like title, description, weight, and more.
  • Validate the values of form elements during form validation.
  • Set form errors when rule-based validation fails.
  • Redirect users to a different page upon viewing or submitting a form.
  • Examine the attributes of elements in active forms with the element inspection tool.

Especially the "Redirect users to a different page upon viewing or submitting a form" should help to address your question.

  • Never heard of this module until now. Rules forms saves time and cost by affording site builders the ability to monitor and alter forms without the need to implement a custom module. Sounds like a very handy module to have. – No Sssweat Apr 7 '16 at 8:52
  • 1
    Merci @NoSssweat ... So how many of the +17.000 do you think you have 'heard' about (my answer: maybe i heard about somewhere between 500 and 1.000 ...) ? That's what makes the job of a site builder, and/or site architect so interesting (I think) ... instead of digging in the (boring?) API docu, etc, right? FYI: my own very last "hidden gem" I discovered ... the Goals module ... another KeepIt-SuperSimple case IMO. – Pierre.Vriens Apr 7 '16 at 9:00
  • 1
    @ Pierre.Vriens wow, just wow!!! hidden gem indeed! – No Sssweat Apr 7 '16 at 9:10
  • 1
    @NoSssweat : At the risk of running (soon) in "avoid extended discussions": if you didn't do so yet, go look at the module video ... Also be aware that "something" is in the pipeline about its maintainer-ship ... especially since it seems a perfect complement to the Answers module ... PS: there is even a goals tag already around here ... – Pierre.Vriens Apr 7 '16 at 9:14
  • Thanks for the answer. I installed this module but unfortunately it's a bit useless. The settings of the module isn't in a single page, for every page reload it asks for something to enable. I will try to find another solution and if I can't I will try this module again. – herci Apr 7 '16 at 9:56
1

I used a very simple method for this. I created a custom block and add this HTML code:

<form action="advanced-search" method="GET">
   <input type="search" name="full_text">
   <button type="submit">Search</button>
</form>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.