Gravity Forms Read Only Fields

THIS POST MAY CONTAIN AFFILIATE LINKS. PLEASE READ OUR DISCLAIMER FOR MORE INFO.

In this article, I’ll show you how to make any input field in your Gravity Forms form read-only, preventing the data in the field from being modified.

The Use Case:

There are several reasons for this solution, however, we needed this solution for a specific project where we built a membership site with Gravity Forms.

When the user signs up for a free trial, we used a hidden field to record the “Enrollment Date”. When their trial is over, they are sent to a subscription form to start their paid subscription. We also use a hidden field in this form to capture their “Subscription Date”.

Those two dates are displayed on the My Account page in a form that the user can use to update their profile information. However, we don’t want the user to modify or change those dates, so we made the fields read only.

Step One

The JavaScript code snippet below is what we will use to create the magic.

Note: This snippet will only work for text input fields, i.e Single Line Text, Name, Email. If you need to make a paragraph field, checkbox field, or radio field read-only, there are some additional code snippets available in this article.

  1. Copy the code above
  2. Add an HTML Field to your form
  3. Past the code in the Content area

Step Two

Now that the code is in place, the next step is to add the gf_readonly class to the fields you want to make read-only.

  1. Click on the field you want to edit
  2. Open the Appearance Tab
  3. Add gf_readonly to the Custom CSS Class field

Note: If you already have another class in the field, you can still add another one, just be sure to add a space between the classes.

No Code Method

There is a way to make your fields read-only without messing with code. It requires a third party add-on, but it makes the read-only function available any time and for almost any field.

The Wrap Up

This is a nice solution to have on hand, for when you need it. And it’s one of those things that shows you that Gravity Forms is really capable of a lot more than you think.

If you have questions or need help, feel free to use the comments below.

  • Get the latest news, tips, and how-tos all delivered to you!

    Your information is used only for email communications by GravityRanger. We do send the occasional product promotion email.

    Name*
    This field is for validation purposes and should be left unchanged.


    >