Tag Archives: gravity forms

[solved] Gravity Forms with Javascript Validation

Gravity Forms (www.gravityforms.com), without a doubt is one of the best WordPress forms plugin out there, I have been using it since it was launched and is a brilliant tool and I have it in use on literally hundreds of web sites.

However, recently I have had the need to put javascript validation on some forms and unfortunately, Gravity forms does not natively support it.

When I contacted Gravity Support to ask about javascript validation, they basically told me its not supported and I was on my own.

So below, is some jquery code I have scrapped together to get it working.


Just assume that the form is Form ID is 7, the rest should be self explanatory.

The code can be put anywhere you like as long as it’s before the Gravity Form function call.

<!-- For Gravity Forms Validation Top Form -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
jQuery(document).ready(function() {
jQuery("#gform_submit_button_7").click(function() {
return GravityFormValidation_7(gform_7);

function GravityFormValidation_7(Form){

if (Form.input_7_1_3.value == “”){
alert(“Please enter your Name”);
return (false);

if (Form.input_7_2.value == “”){
alert(“Please enter your Phone Number”);
return (false);

if (Form.input_7_4.value == “”){
alert(“Please enter your Email Address.”);
return (false);


[solved] Changing Field Labels in Gravity Forms with gform_pre_render

I have taken on a wordpress project recently which required me to change the language of the text in the field labels on some gravity forms.

The site is in one language, but within wordpress they have the option to show certain pages in a different language, for example Norwegian.

So, if we have a form with the default text of Name and Telephone and the form was being shown on a Norwegian page, then the text would need to display: Navn and Telefon.

On the left is the form with the english texts and on the right is the form when the setting of the page is set to Norwegian.


The guys at Gravity Help showed me this page: https://www.gravityhelp.com/documentation/article/gform_pre_render/ which is slightly too advanced for what I wanted to do because all I need to do is change the words in the gfield_label within the form.

In the end, I came up with this solution below which works perfectly: