| CARVIEW |
Select Language
HTTP/2 301
date: Mon, 29 Dec 2025 11:24:13 GMT
content-type: text/html; charset=UTF-8
location: https://docs.gravityforms.com/gform-post_render/
server: cloudflare
x-redirect-by: Yoast SEO Premium
x-frame-options: SAMEORIGIN
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
referrer-policy: strict-origin-when-cross-origin
fastcgi-cache: MISS
strict-transport-security: max-age=31536000; includeSubDomains
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=I6kX8X%2Bpe4FJ1axxYjQ%2BojeM1%2FLr6fNL14JduK5cLAvD5oFbGizMtFIyLmPPQbPEK7qXZirCixZtFQk3yR1HzobLFQxjwKzqmZxNVdVdz%2BsjKDKt"}]}
cf-ray: 9b58ee068b311712-BLR
HTTP/2 200
date: Mon, 29 Dec 2025 11:24:14 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
vary: Accept-Encoding
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
content-security-policy: frame-ancestors 'self';
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
link: ; rel="https://api.w.org/"
link: ; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
fastcgi-cache: HIT
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=Iu%2B8Cbaj4JxP4q7iZbk8DWBG5qwolVttLAzv2xAIMB%2FKzvNXxKWPXTbLLO6k8LREeaXox6MfAD667Ykq%2BLA%2FebIicGmQ40tEcjR0Eb30QjCKVwQl"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 9b58ee08ce221712-BLR
gform/post_render - Gravity Forms Documentation
gform/post_render
Description
The gform/post_render event can be used to initialize scripts when a form loads. It is a direct replacement for gform_post_render.
Usage
The gform/post_render event can be used with the standard addEventListener method:
document.addEventListener('gform/post_render', (event) => {
// Do something.
});
Parameters
- event JavaScript Object
The event object.- detail JavaScript Object
The event detail object.
- detail JavaScript Object
Examples
Accessing the event details
document.addEventListener('gform/post_render', (event) => {
const formId = event.detail.formId;
const pageNum = event.detail.currentPage;
});
Aborting submission on Enter
The following example shows how you can prevent a specific form, in this case ID 2, from submitting if the user presses the enter/return key when adding a value to an input.
document.addEventListener('gform/post_render', (event) => {
if (event.detail.formId !== 2) {
return;
}
const isApplicableEvent = (keypressEvent) => {
const target = keypressEvent.target;
// Check if the key pressed is Enter and the target is not a textarea, submit button, or button
return keypressEvent.key === 'Enter' && !(target.tagName === 'TEXTAREA' ||
(target.tagName === 'INPUT' && (target.type === 'submit' || target.type === 'button')));
};
document.addEventListener('keypress', (keypressEvent) => {
if (isApplicableEvent(keypressEvent)) {
keypressEvent.preventDefault();
}
});
});
Placement
Reference the article Adding JavaScript Code to the Frontend of Your Site.
Since
This event was added in Gravity Forms v2.9.0
Source Code
This event is located in GFFormDisplay::post_render_script() in /form_display.php.