Skip to content

Google Forms Field Ids - The Easy Way

Getting the field ids of a google form is required to pre set certain fields with GET parameters. However, figuring out the ids of all different field types by inspecting, searching and guessing is a pain.

To overcome this, I wrote a small script that will print the field ids to the console next to the field label headlines, so there's no guessing involved.

Just paste the script into the developer console in the preview or public view of your form, hit enter and you're done.

js
document.querySelectorAll('[data-params]').forEach(item => {
    const name = item.dataset.params?.match(/\[\[(\d+)/)?.[1];
    if (!name) { return false; }
    const node = document.createElement('code');
    node.innerText = `GET parameter: entry.${name}`;
    node.style.setProperty('margin', '1rem 0')
    item.querySelector('[role="heading"]')?.parentNode.appendChild(node);
})

Clicking this button loads third-party content from utteranc.es and github.com