Add voice responses to a FormAssembly open end with one block of custom code. FormAssembly runs your JavaScript on the published form, which is all the widget needs.
AvailableIn the form builder go to Properties > Custom Code and paste the block from your dashboard, then click Apply. Replace the field ids with your own: FormAssembly numbers them tfa_1, tfa_2 and so on, and each field's properties panel shows its id.
<script>
(function () {
var PROJECT_KEY = 'proj_XXXXXXXX';
var SESSION_FIELD = 'tfa_20'; // id of a Hidden Field added to this form
var QUESTIONS = [ // your answer fields, in order
{ field: 'tfa_5', question: 'q1' },
{ field: 'tfa_6', question: 'q2' }
];
function mount() {
var sf = document.getElementById(SESSION_FIELD);
var sessionId = (sf && sf.value) ||
('fa_' + Date.now() + '_' + Math.random().toString(36).slice(2, 10));
if (sf) sf.value = sessionId;
var wraps = [];
QUESTIONS.forEach(function (q) {
var el = document.getElementById(q.field);
if (!el || el.getAttribute('data-gv-done')) return;
el.setAttribute('data-gv-done', '1');
var w = document.createElement('div');
w.setAttribute('data-project', PROJECT_KEY);
w.setAttribute('data-target', '#' + q.field);
w.setAttribute('data-session', sessionId);
w.setAttribute('data-question', q.question);
w.setAttribute('data-lang', 'es');
el.parentNode.insertBefore(w, el);
wraps.push(w);
});
var s = document.createElement('script');
s.src = 'https://api.voicecapture.ai/voice.js';
s.onload = function () {
wraps.forEach(function (w) {
if (window.GeniusVoice && GeniusVoice.init) GeniusVoice.init(w);
});
};
document.body.appendChild(s);
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', mount);
else mount();
})();
</script>The block takes a QUESTIONS array: each entry pairs a field id with a short label that travels with the recording. Add one entry per open end you want voice on and they are mounted independently, each with its own microphone, so a long form can carry voice on three or four questions without a second snippet. The labels are what let you tell the answers apart in the export, so give them names you will still recognise later.
FormAssembly runs custom JavaScript only on the published form. In Preview the block never executes, so the microphone simply will not appear — that is expected and is not a sign the setup is wrong. Open the live form link, record ten or fifteen seconds and let it finish uploading before you submit.
This is the step most setups skip, and it is the one that catches a silent failure. Watch the Voice Capture dashboard: the transcript should land within about half a minute. Then submit the form and check your FormAssembly response. The transcript should be sitting in the answer field itself, and the hidden field should carry the respondent key. A recording that transcribes perfectly but writes nothing back into the form leaves you with a correct transcript in one system and an empty answer in the other.
Publish as usual. Recordings upload and transcribe during fieldwork, so the open end is readable while the form is still live rather than at the end. Export to CSV on any plan, or to Excel on a paid credit pack, and join it to your FormAssembly export on the respondent key.
You are almost certainly looking at Preview. FormAssembly runs custom code only on the published form, so open the live form link and test there.
Check the project key in the block first. If the key is right and the form is served from your own domain, add that domain under Allowed domains in the project.
The Hidden Field id in SESSION_FIELD does not match the field on the form. Outside Alchemer the respondent key is what ties the Voice Capture export to the FormAssembly export, so without it the two cannot be joined.
The step-by-step guide, including the verification step that confirms the transcript actually lands in your form data.
Read the FormAssembly guideOur AI assistant can walk you through the setup step by step.
Set up Voice Capture in under 5 minutes. No credit card. No commitment.
Get Started FreeWe use cookies to improve your experience and analyze site traffic. Learn more