I have enabled a .tpl.php file in theme in drupal 7 which contain a form field. So my requirement is to redirect the from field action to another external link after getting value from that from field. The form field value i.e is used in external link redirection. Please help me how can i redirect the form action with getting value from that single field.

  • try to use a form_alter hook -> drupal.org/docs/7/api/form-api/… Then add a submit handler that redirects you wherever you want -> drupal.stackexchange.com/questions/5861/… – DiDebru Feb 13 '18 at 7:31
  • 1
    Possible duplicate of How to redirect to a page after submitting a form – DiDebru Feb 13 '18 at 7:31
  • what u suggest are possible through modules but I have enabled a external theme mytheme.tpl.php and that theme contain a form field from which i have to take value and use that field value in external link @Insasse – Pratish Jha Feb 13 '18 at 7:38
  • Than just get the value from the form_state object in your submit handler and set it as redirect url. – DiDebru Feb 13 '18 at 7:46
  • If the form is directly in the template file, I would suggest to rebuild it programmatically in a module. – DiDebru Feb 13 '18 at 7:54

Your Answer

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

Browse other questions tagged or ask your own question.