0

I need to send data in the URL to the receiving server so that two fields from a survey form is put in the Completed URL string. It looks like it should be possible to use tokens for this, but I can't seem to figure out the correct syntax to use.

I need to send the response to a URL on the form

https://server.tld/sub/value1/value2

where value1 and value2 are fetched from form fields and the rest is static.

According to https://www.drupal.org/project/webform/issues/3021818 this should be possible, if I only could find the correct syntax to use to add the tokens.

Background The user gets a link to the survey form in a text message. After filling in the form, the Remote Post handler functionality in Webform should post the results to an external server that expects the survey ID and user alias as parts of the URL (for reasons unknown to me, but apparently expensive and difficult to change) for the purposes of knowing when the user has filled in the survey so as to avoid sending out a reminder.

What I have tried I have tried formatting the Completed URL string in various ways; like for example

http://example.com/%value[my_fieldset][a_value_in_the_form]

and

http://example.com/%value

but I just get a URL invalid error response when I try to save the setting.

4
  • 1
    It's not clear what you are asking. What form ? What response ? Give us some context. Give an example or give some code that you have tried.
    – GiorgosK
    Commented Mar 31, 2019 at 15:24
  • I have a survey form with a bunch of questions, it includes two hidden values (a survey id and a user alias) that needs to be present in the Completed URL string since that's how it should be sent to the receiving server that keeps track of sending out survey reminders. I haven't really found anything useful on how to format tokens in the Completed URL field, so I've tried stuff like example.com/%value example.com/%value[my_fieldset][a_value_in_the_form] but I just get invalid format error when I try to save it. Commented Mar 31, 2019 at 17:01
  • This drupal.org/project/webform/issues/3021818 suggests it should work, but like I said, I'm not sure how to format the Completed URL string. Also, I don't have control over how the receiving server wants the data. Commented Mar 31, 2019 at 17:02
  • Completed URL is the url that the person goes to after submission ? What is the receiving server ? The website server or some other server ? Its always nice to have a clear example of what you mean. A step by step of this process might make it more clear. Please update your question and try to make it as clear as possible in order to maximize the chances of getting an answer. The comments above shed some light but try to make them part of the question please.
    – GiorgosK
    Commented Mar 31, 2019 at 17:52

1 Answer 1

0

I managed to get it going using the standard tokens so in Completed URL I had https://URL/API?query=[webform_submission:values:fieldname] - so just swap out fieldname for the key in the webform you want to pass

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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