How to prefill fields when embedding a 123FormBuilder online form?

If you want to prefill form fields when embedding your form on a webpage, you can do that by tweaking and using the Javascript code from the forms Publish → Embed form section within the form builder.

Important note: when sharing the form link or publishing the form on WordPress, the procedure is different.

Read more about how to prefill form fields on WordPress.

Read more about how to prefill form fields when sharing the form link.


Customizing the embed code

Here is an example code that you can paste into your web page, and make the adjustments indicated below.

<!-- form.123formbuilder.com script begins here -->
<script type="text/javascript" defer src="https://form.123formbuilder.com/embed/YourFormID.js" data-role="form" data-default-width="650px" data-custom-vars="control33333333-1=John&control33333333-2=Doe&control55555555=johndoe@company.com">
</script><!-- form.123formbuilder.com script ends here -->

There are three areas in which you need to focus:

  • Replace YourFormID with the actual ID of your web form.
YourFormID
  • The function data-custom-vars is not added by default if you copy the Javascript code directly from the Publish → Embed section. Therefore, you’ll need to add it manually to your code, followed by the IDs of the form fields you want prefilled with the desired values.
data-custom-vars
  • Following, control3333333-1=John means that the field with the ID control3333333-1 has John as the prefilled value. The field with the name control3333333-2 is prefilled with the value Doe, and so on. Field – value pairs are linked through the operator &. To identify form field IDs, inspect the form code using a browser inspection tool.
controID

When you have a form field split into several subfields, you need to add the subfields number after the field ID. For example, the Name field contains the First Name and the Last Name subfields. These two have separate IDs: First Name – control33333333-1, Last Name – control33333333-2.

As previously mentioned, if you’ve copied the code from the Publish section, you need to add this extra part to your embed code. Replace the control ID with your own field’s ID and our default values with your desired ones.

data-custom-vars="control33333333-1=John&control33333333-2=Doe&control55555555=johndoe@company.com">
Prefill fields on embedded form

7 comments

  1. What’s the point of having prefilled fields? Can’t you just do that in the form builder itself? What I want to know is how I can have a custom link and that link/URL pre-fills in certain data. I found how do do that if the form is it’s own webpage, but I can’t find out how to do that if the form is embedded. I’m using Wix. Have any ideas?

  2. Hi! I simply wish to give you a big thumbs up for your great info you have got here on this post. I will be returning to your site for more soon.

  3. I needed to thank you for this good read!! I certainly enjoyed every bit of it. I’ve got you book marked to check out new stuff you post…

Leave a Reply

Your email address will not be published. Required fields are marked *

Frequently Asked Questions

Here is a list of the most frequently asked questions. For more FAQs, please browse through the  FAQs page.

Is this service free?
Yes, we offer a free form builder service. Just sign up to the Basic plan and you are all set. This plan is forever free, but you are limited with a few features only, such as 5 forms per account, 100 submissions per month and you have to keep the backlink to 123FormBuilder on your forms. Check out our features matrix for more information.
How many forms can I create?
It depends on the service plan you are on. Higher service plans enable more features, including more web forms for your account. If you need more forms, go to the My Account section of your account and click the upgrade button. To create an unlimited number of forms, either upgrade to the Platinum service plan or higher. Consult our features matrix for more information.
How can I publish my forms?
You can publish your forms in many ways, by using their direct URL or HTML link, embedding them with a JavaScript code, Inline HTML or iFrame, using the Facebook app or the WordPress plugin, using popups, the Blogger code snippet and many more. Once you have created and customized your form, go to the Publish section to complete your work. Read more in our documentation.
How do I change my form design?
You can change the design of your form for more information. in the Themes section, which is located in your form settings. We offer a set of more than 30 predefined form themes for your forms, but you can also create your own from scratch. You can customize the submit button, the logo and more. To apply your own stylesheets, all forms come with a custom CSS editor.

Can't find what you're looking for?