Voiceflow PartnersVPVoiceflow Partners
Powered by
ZaynZ
Voiceflow Partners•7mo ago•
3 replies
Zayn

Error in Custom Form extension

Hey guys, I am having an error with my form custom action Uncaught TypeError: Cannot read properties of undefined (reading 'name’). Can anyone help me with this. Can't share the whole code will send it separately:
<script>
const ArticleFormExtension = {
name: 'ArticleFormExtension',
type: 'response',
match: ({ trace }) => trace.type === 'ArticleForm',
render: ({ trace, element }) => {
const form = document.createElement('form');
form.innerHTML = ``;
element.appendChild(form);
const $ = (s) => form.querySelector(s);
const $$ = (s) => Array.from(form.querySelectorAll(s));
form.addEventListener('input', (e)=>{
const t = e.target;
if (t.classList.contains('invalid') && t.value.trim()!=='') t.classList.remove('invalid');
});
form.addEventListener('submit', (e)=>{
e.preventDefault();
let ok = true;
$$('.invalid').forEach(el=>el.classList.remove('invalid'));
$$('input[required], select[required]').forEach(el=>{
if (!el.value) { el.classList.add('invalid'); ok=false; }
});
if (!ok) return;
const payload = {
//Data here
}
};
form.querySelector('.btn').disabled = true;
window.voiceflow.chat.interact({ type: 'complete', payload });
});
}
};
</script>
<script type="text/javascript">
(function(d, t) {
const v = d.createElement(t),
s = d.getElementsByTagName(t)[0];
v.onload = function() {
window.voiceflow.chat.load({
verify: { projectID: 'Project ID' },
url: 'https://general-runtime.voiceflow.com',
versionID: 'production',
assistant: {
extensions: [ArticleFormExtension]
}
});
};
v.src = "https://cdn.voiceflow.com/widget-next/bundle.mjs";
v.type = "text/javascript";
s.parentNode.insertBefore(v, s);
})(document, 'script');
</script>
IMG-20250829-WA0004.jpg
Voiceflow Partners banner
Voiceflow PartnersJoin
Exclusive community for Voiceflow Solutions Providers & Content Creators.
13,076Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements
Recent Announcements
jacklyn

# Let your agents search the web 🔎 Hey everyone! We just released the web search tool for the agent step! Your agents can now automatically search the web for information, letting your agent supplement the LLM's knowledge and the data in its knowledge base with live, up-to-date information. Plus.... * You can restrict searches to specific domains, so your agent only searches sites that you own * This is a tool, so you remain in control of when the agent searches the web * Results are automatically summarized in a way that your agent can automatically understand Under the hood, we're using OpenAI's web search API. Give it a try, and let us know what you think! https://docs.voiceflow.com/changelog/native-web-search-tool

jacklyn · 4mo ago

jacklyn

jacklynbiggin's Thread

jacklyn · 4mo ago

hurt-tomato

connor_maclean's Thread

hurt-tomato · 4mo ago

Similar Threads

Injecting Voiceflow variables into a custom extension?
RomAIxRRomAIx / ❓┃ask-a-question
6mo ago
how to build a custom form
wet-aquaWwet-aqua / ❓┃ask-a-question
2y ago
Custom Widgets & Effects (Beta) Feature - Form - Issues
accused-moccasinAaccused-moccasin / ❓┃ask-a-question
2y ago
Custom Extensions Like Confetti Effect
RomAIxRRomAIx / ❓┃ask-a-question
8mo ago