Skip to content
Developer

Questionnaire widget

Let people complete questionnaires from vynst on your website, such as sign-ups, surveys, cancellations or withdrawals, with drafts, attachments and prefilled answers.

The widget shows a questionnaire from vynst (inwendo ERP) with all questions, pages and terms. The answers go straight into vynst, where you evaluate or process them.

<div data-iw-questionnaire
     data-iw-host="club.iw-erp.de"
     data-iw-questionnaire-id="kuendigung"></div>
<script src="https://club.iw-erp.de/frontend_assets/backend/iw_erp_web_ui/questionnaire.js" async></script>

Shortcode: [iw-questionnaire host="club.iw-erp.de" id="kuendigung"]

Options

Attribute Default Meaning
data-iw-questionnaire-id ID, token or short name of the questionnaire
data-iw-answer-token empty continue an unfinished answer (draft)
data-iw-draft off save new answers as a draft first
data-iw-show-draft-button off show the button “Save draft”
data-iw-auto-save-draft off save drafts automatically while typing (with data-iw-answer-token)
data-iw-hide-questionnaire-title off hide the subheading “Questionnaire”
data-iw-hide-participant off do not ask for contact details if the questionnaire does not require them
data-iw-prefill empty preselect answers, as JSON {"Question text": "Value"}. The value must be one of the answer options.
data-iw-lookups empty name the questions for the IBAN check, as JSON {"iban": "IBAN", "bic": "BIC", "institution": "Name der Bank"}. From the IBAN, the widget fills in BIC and bank.
data-iw-session-token empty session of a logged-in member. The answer then belongs to their account.

Texts you adjust often: participant (heading for contact details), start, send, success.

<div data-iw-questionnaire
     data-iw-host="club.iw-erp.de"
     data-iw-questionnaire-id="kuendigung"
     data-iw-text-participant="Your membership details"
     data-iw-text-send="Submit cancellation"
     data-iw-prefill='{"Grund der Kündigung": "Umzug"}'></div>

The widget cannot display questions of the type Ticket. Use the vynst app for these.

Attachments

If the questionnaire allows attachments, visitors can upload files. They are attached to the answer in vynst.

Set up in vynst

  • Make the questionnaire public. Without this release, the widget shows the text notAllowed.
  • Enter your website under CORS - Permitted origins.

Events

iw:questionnaire:ready, :page-change, :submit-start, :submitted, :draft-saved, :error and :link.

If you show several questionnaires one after another in the same element, clean up first with IwQuestionnaire.destroy(element) and start the next one in a new element.

API

The widget uses GET /api/media/questionnaire/{id} and POST /api/media/public/questionnaire_answer. For drafts, it uses …/questionnaire_answer_draft. Details under Media.