0

I have made a Feedback Form in comments entity, Each node has multi file fields, I'm looking to force the users to submit the form & give their feedback after that redirect them to file download when click submit button, I'm using Views & Custom Formatters and I made the feedback form displays in Colorbox popup to keep them on the same page

feedback URL "node/%/feedback"

is there any function that can help me ? I'm using Drupal 7

  • I'ts a drupal 7 form made with form API, or it's just HTML? – mistermoper Sep 29 '17 at 18:19
  • Hi ! it's drupal 7 form API ! is there any simple way to do it ?? thank you – MohK Sep 29 '17 at 19:32
1

You have to add a submit function if you dont have and set the url you want redirect in $form_state['redirect'].

function my_custom_form_submit($form, &$form_state) {
  $form_state['redirect'] = 'node/10';
}

More information here.

  • Please, just something! How can I make the URL change automatically, Change it with file URL " audio/[file:name]?download " ? – MohK Sep 29 '17 at 20:48
  • First, if your URL is node/%/feedback you must change it to node/%node/feedback to ler drupal knows that URL contains q node id, and clear caches. Then in form submit you can declare a variable like This: $node = menu_get_object(); (api.drupal.org/api/drupal/includes%21menu.inc/function/…). Now you have the node object in a variable, and you can inspect his value with dpm function from devel module (drupal.org/project/devel) in order to know where is your audio file name. I doesnt have my computer to test it correctly but it should works. – mistermoper Sep 29 '17 at 21:17
  • Thank you so much Mr.Omar but let's say it's hard for me to do it because of my coding level :p, please is it possible for you to help me with that, send you the site & SQL file, please – MohK Sep 29 '17 at 22:07
0

You should use custom submit handlers for your form.

After submitting the first form, you should make a redirect tour feedback form and after submitting the comment form you should make a redirect to the files page.

See this tutorial for further information.

  • Hi ! Thank you so much, this is so helpful but my problem is I'm not so good in codes so I don't know how to do it & what should I change ... is there any simple way thank you – MohK Sep 29 '17 at 19:34

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.