Pre-fill form fields with URL parameters
Pre-fill a Revup-hosted or embedded form using URL parameters or JavaScript.
Before you start
- Publish the promotion as a Revup-hosted page or embed it on a page you control.
- Decide which field should receive the value.
- Do not place personal or sensitive informationโsuch as names, email addresses, phone numbers, street addresses, passwords, payment information, or passcodesโin a URL. URLs can appear in browser history, analytics, logs, and referral data.
Find the Field ID
- Open the promotion builder and select Form.
- Open the field you want to pre-fill.
- Select Advanced.
- Find Field ID and copy its value, such as
first_nameorff_123.
Field IDs are assigned by Revup and cannot be edited. Each field in the form has its own ID.
Add the value to the page URL
Add the Field ID and value to the promotion URL. For a Revup-hosted promotion, add it directly to the hosted URL:
https://example.revup.com/p/view-your-promotion?first_name=JamieFor an embedded promotion, add it to the URL of the page containing the form:
https://example.com/giveaway?first_name=JamieTo pre-fill more than one field, separate the parameters with &:
https://example.com/giveaway?first_name=Jamie&city=New%20YorkEncode spaces and special characters before adding them to a URL. Most URL-building tools do this automatically.
Pass a value to another form
Send the participant to a page containing the destination Revup form, and include the destination field's Field ID in that page's URL. The destination field IDs do not need to match the IDs in the first form.
Revup does not automatically copy a response from one submitted form to another. The link or redirect to the destination page must include the value as a URL parameter.
Pre-fill an embedded form with JavaScript
When your own site already knows a value, such as a signed-in customer's first name or a campaign code, your page can send it to an embedded Revup form with JavaScript instead of putting it in the URL. This works only for promotions added to your page with the Revup embed code.
- Add the Revup embed code to your page.
- Add a script to the same page that waits for the
revup_loadedevent, then callswindow.revup_widget.prefill_field()with the Field ID and the value:
<script>
window.addEventListener('revup_loaded', function (event) {
window.revup_widget.prefill_field('first_name', 'Jamie', event.detail.id);
window.revup_widget.prefill_field('ff_123', 'spring-campaign', event.detail.id);
});
</script>- Wait for
revup_loaded. The form ignores values sent before it has finished loading. event.detail.idtargets the form that just loaded. If your page has more than one Revup promotion,event.detail.promotion_idcontains the promotion's number, so you can check it before filling fields.- To fill every Revup form on the page, leave out the third value:
window.revup_widget.prefill_field('first_name', 'Jamie'). - Values longer than 4,096 characters are ignored.
Participants can see and change values in visible fields before they submit, and anyone with browser development tools can change any value. Do not rely on a pre-filled value to prove identity or eligibility.
What happens next
When the form loads, Revup compares the relevant page URL parameters with its Field IDs. A hosted promotion uses its own URL; an embedded promotion uses the URL of the page containing it. A matching supported field receives the supplied value. Values sent with JavaScript are applied the same way. Normal required-field rules, formatting, and validation still apply when the form is submitted.
Name, email, phone, Text Input, and Text Area fields can be pre-filled, including fields set to Hidden Field. Phone numbers are formatted for the field's country. A Dropdown is pre-filled when the value exactly matches an option's original text, such as Option 2. Renaming or translating an option later changes only what participants see, so keep using the text the option had when it was first added. Checkbox and Multiple Choice fields cannot be pre-filled, and neither can file uploads, CAPTCHA, payment, signatures, or consent checkboxes. Test the published experience before relying on prefilling for date or other specially formatted fields. Anonymous surveys ignore pre-filled values.
If a field stays empty, confirm that the URL parameter or JavaScript Field ID exactly matches the Field ID, URL values are URL-encoded, JavaScript runs inside a revup_loaded listener, and the page uses the current Revup embed code.
Was this helpful?
More in Build, Publish & Automate
Add bonus actions, coupons, and passcodesUse custom CSS safelyCustomize the form title and descriptionDesign a promotion with themes and brand settingsStill need help? Ask the team