Error is raised when I try to redirect webform submission to external webpage with query string

drupal.stackexchange https://drupal.stackexchange.com/questions/272890

  •  05-02-2021
  •  | 
  •  

سؤال

Dear Drupal community,

I created a webform using the webforms module in Drupal 8 in order to add information to a webpage. Since I don't want to update the webpage manually I'd like to automatize this process by redirecting the information entered in the webform to a cgi script which then takes care of the rest (The target webpage is not based on drupal). So I used the [webform_submission:values:<>] tokens and added them in the query string of the external url. In principle it works, but I noticed that for some fields in the webform entries spaces and special characters like " and ' are possible. In these cases I get an error message that the confirmation URL is not valid. I attached a .png. At the blue line you see a space, this seems to be what causes the problem. But if I enter the url manually in the browser my cgi script works as expected. So I only need to prevent drupal from stopping the redirect.

I appreciate any help.

best regards

ps. I created the same post over at the drupal.org forum. Strangely though, I don't see my post appearing at the forum.

pps. While the approach with the query string is probably an unsafe approach it's alright for my purpose since everything happens in an password protected internal area.

enter image description here

هل كانت مفيدة؟

المحلول

I think there's an easier way to achieve what you want.

In you webform go to "Settings > Form" then you'll see near the bottom "Custom settings" with a dropdown for "method". There you can change it to "GET (Custom)" then enter the url for your third party site.

If you needed the get variable names to be something specific you might need to remake your fields with the right key to match your get variable names you need.

But that should do the trick and it will take care or encoding any special characters for you

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى drupal.stackexchange
scroll top