drupaldrupal-formsdrupal-search

Display search result after submitting on the same page using drupal 7


I want a form with one text field and one submit button. When I'll click on the submit for the data entered in the text field, which can be the ID of some node, then it should return the id of the node with the link to same node. And the data should be displayed in the same page showing the search form with retained values. Please don't provide any alternative and I want to implement without views. Please provide the procedure to implement it, if possible. I am new to Drupal customization. Need help.

Thanks


Solution

  • You will need to create a simple custom module for this

    1. Create your new module (http://drupal.org/node/361112)
    2. Create the page and add the form (http://drupal.org/node/1043838)
    3. On form submit, check if node by give ID exists
    4. Load node and get the node url (or alias) (Getting the URL of a node in Drupal 7)
    5. Display the results (see default_value in http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7)