| CARVIEW |
Select Language
HTTP/2 301
date: Tue, 30 Dec 2025 02:21:57 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=lQRh96sONNuFiDvf27GjAeZjF9ZofxeKksGDR3708lPoKru%2B%2BZLXOtUKKfvaz3jXpURzXBCjbXstD0B8%2BBN513zJlo3DIud2ZuNJwE1%2Bk6UTrm0Y"}]}
cf-ray: 9b5e110fde20f424-BLR
HTTP/2 200
date: Tue, 30 Dec 2025 02:21:58 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=tacuvr9Qa4oIW0JZtieifrPNsyaq%2Bh39ttNHmkWnu2XdP5xMAxiXVEe%2BOaVxXVM3oBiHMUzTitXDa6%2FP01dZgbUhE4J1p7WuKJ0FZs8NAFyohqJC"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 9b5e11156bcbf424-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.