Skip to main content

Generate Fake DataNew in 5.2+

If you ever wish to preload form fields with automatically generated fake submission data for testing purposes or other reasons, you can do so with Freeform's implementation of the Faker library. It's already included, so you don't need to install or enable anything extra.

Please note that any Faker variables you add to forms will be visible to anyone when the form is displayed on the front end. This is intended for testing purposes only.

Common Formatters

Below is a list of common formatters for using with Freeform forms. For the complete list of formatters, please see the Faker documentation.

Please note that not all Faker formatters and syntax noted on the Faker documentation will work inside Freeform.

Freeform FieldFaker FormatterExample OutputNotes/Recommendations
Full Name{{ faker.name|raw }}Blanca Hane, Dr. Zane Stroman, Alexandria Cronin Jr., etcNames may randomly include prefixes and suffixes. Use |raw filter.
First Name{{ faker.firstName|raw }}JohnUse |raw filter.
Last Name{{ faker.lastName|raw }}SmithUse |raw filter.
Title{{ faker.title }}Mrs., Dr., etc
Suffix{{ faker.suffix }}Jr.
Company Name{{ faker.company|raw }}Smith & Sons LtdUse |raw filter.
Job Title{{ faker.jobTitle }}Cashier
Email Address{{ faker.email }}hickle.lavern@erdman.com
Safe Email Address{{ faker.safeEmail }}spencer.ricardo@example.com, wolf.sabryna@example.org, etc
Company Email Address{{ faker.companyEmail }}john@smithandsons.net
Domain Name{{ faker.domainName }}toy.com, schamberger.biz
URL{{ faker.url }}http://cormier.info/eligendi-rem-omnis-quia.html, http://pagac.com/
Username{{ faker.userName }}ipaucek, homenick.alexandre, etc
Password{{ faker.password(10, 20) }}dE1U2G$n4g%-EiehJrn, YCc1tNShgU&j6Z, etcThe arguments define the minimum and maximum number of characters, respectively. By default, the values 6 and 20 are used for the minimum and maximum, respectively.
Phone Number{{ faker.phoneNumber }}827-986-5852
Street Address{{ faker.streetAddress }}439 Karley Loaf Suite 897
City{{ faker.city }}Winnipeg
US State{{ faker.state }}California
US State 2-letter code{{ faker.stateAbbr }}CA
US Zip Code{{ faker.postcode }}90210
Complete Address{{ faker.address }}8888 Cummings Vista Apt. 101, Susanbury, NY 95473
Country{{ faker.country }}Canada
Country Code{{ faker.countryCode }}LK, UM, CZ, etc
Sentence (single){{ faker.sentence(6) }}Sit vitae voluptas sint non voluptates.Argument is for number of words.
Sentences (multiple){{ faker.sentences(2, true) }}Optio quos qui illo error. Laborum vero a officia id corporis. Saepe provident esse hic eligendi.First argument is for number of sentences. true is required for the second argument so it returns a string instead of an array.
Paragraph (single){{ faker.paragraph(4) }}Sequi incidunt et voluptas consequatur sed. Incidunt minima est omnis. Placeat assumenda similique inventore quos. Nemo ex et nam tempore nihil.Argument is for number of sentences.
Paragraphs (multiple){{ faker.paragraphs(2, true) }}Quia odit et quia ab. Eos officia dolor aut quia et sed. Quis sint amet aut. Eius enim sint praesentium error quo sed eligendi. Quo id sint et amet dolorem rem maiores.

Fuga atque velit consectetur id fugit eum. Cupiditate aut itaque dolores praesentium. Eius sunt ut ut ipsam.
First argument is for number of paragraphs. true is required for the second argument so it returns a string instead of an array.
Real Text{{ faker.realTextBetween(200, 300, 5)|raw }}Pigeon. 'I'm NOT a serpent!' said Alice indignantly. 'Let me alone!' 'Serpent, I say again!' repeated the Pigeon, but in a more subdued tone, and added with a kind of sob, 'I've tried every way, and.The first and second arguments define the minimum and maximum number of characters per sentence, respectively. The third argument is for the index size (between 1 and 5). The higher the size, the more natural sounding sentences. The lower the size, the more random and less coherent text.
Text{{ faker.text(100) }}Quaerat eveniet magni a optio. Officia facilis cupiditate fugiat earum ipsam nemo nulla.Argument is for the maximum number of characters.
Word (single){{ faker.word }}occaecati
Words (multiple){{ faker.words(5, true) }}molestias repellendus qui temporibus utFirst argument is for number of words. true is required for the second argument so it returns a string instead of an array.
Random Integer (0-9){{ faker.randomDigit }}_ _
Random Number{{ faker.randomNumber(5, false) }}123, 19238, 5, etcFirst argument is for the maximum number of digits. When the second argument contains false, it will be a range between 0 and 99999 (if max digits is set to 5). When using true, it will ensure the value is always 5 digits, so it will be a range between 10000 and 99999 (if max digits is set to 5).
Random Float{{ faker.randomFloat(2) }}43.23, 1203.49, etcArgument is for the number of decimals.
Number Between{{ faker.numberBetween(0, 100) }}32, 4, 91, etcArguments are to specify the range of numbers that can be generated.
Random Letter{{ faker.randomLetter }}b, t, etc
Regex{{ faker.regexify('[A-Z]{5}[0-4]{3}') }}DRSQX201, FUDPA404, etcUse this field to populate Regex fields. Match the regex pattern configured in Freeform. By default, an empty string is used as input.
Language Code{{ faker.languageCode }}av, sc, as, etc
Currency Code{{ faker.currencyCode }}USD, SAR, KZT, etc
Date{{ faker.date('Y-m-d') }}2010-05-22Currently not compatible with the Date & Time field type.
Time{{ faker.time('h:i A') }}11:26 AMCurrently not compatible with the Date & Time field type.
Emoji{{ faker.emoji }}😆, 😡, 😘, etc

Setup Guide

1

Inside the form builder, click on any field you wish to set a fake value for.

2

Inside the Default Value setting for the field, enter a Faker variable. This is constructed as follows:

{{ faker + . + formatterName + }}

Refer to the list of common formatters above for assistance with this.

For example, you will likely add {{ faker.email }} to an Email field, and {{ faker.firstName }} to a First Name field.

3

Faker currently can only be applied to fields that are text/textarea input types. It's also recommended that you apply the |raw filter in cases where you may get values with apostrophes, such as names (e.g. O'Conner).

Once done, your form might look something like this:

On the front end, it will render like this:

4

If you see any errors when attempting to load your form on the front end, you may need to make adjustments to your Faker variables or use a different approach.