Plugin to Disable Gravity Forms Fields
This very simple plugin allows Gravity Forms users to disable (“grey out” or make “read only”) form fields by adding a CSS class name of “disabled” to the field under the Advanced tab or set a field to the readonly attribute with a class of “readonly”.
While working on a client project, I needed to create a form in Gravity Forms that included a “Today’s Date” field. This field was needed as part of an acknowledgement section that contained a clause stating that the person submitting the form agreed that payment would be due within 30 days of the day of submission. I used a Gravity Forms Date field with the current date as a pre-populated value and everything was good. However, it didn’t make sense to allow the user to change that date, especially since the user is agreeing to payment terms that that are dependent on the date of submission. Letting users change the date could lead to abuse and no one wants that. Therefore, I felt it was a good idea to disable the “Today’s Date” field, essentially locking in the date and not permitting the user to change it.
Hi,
Is it possible to disable an option (checkbox or radio field) and not the entire field ? I cannot seem to find a solution.
Thank you !
is it possible to disable a field based on the user id/user email or so?
This would require some custom coding, but yes, it’s possible.
Tried it on WP 4.01 with Gravityforms v1.8.20, could not get it to work despite having tried both “disabled” and “readonly” in the css attribute field. I could still delete and type into the field (Single Text Field)
Is JavaScript enabled on your browser? If so, send me a link so I can take a look.
Yes it’s enabled, sorry I cannot give link right now as It’s a local development wordpress install…
I will see if I can get it online later, then send you a link.
Thank you for the plugin, it’s great. How do you have the date field auto populate itself with today’s date? I feel really dumb asking but I cannot seem to figure it out.
Thank you!
Hi, Jason. Under the Advanced tab of the date field, you will see an input for “Default Value”. On the side is a little icon that will display a list of available merge tags that can be used to pre-populate the field. You can select a date format (i.e. mm/dd/yyyy) and it will populate the date field with the current date.
Great plugin, Ren. I have a solution for this as well with my GP Read Only perk (part of the Gravity Perks package). It also adds a UI element so you can check/uncheck to enable disable the read only functionality for the field. You could probably add the same to this plugin without much effort. 🙂
Hey David. Your Gravity Perks package is very interesting. Thanks for pointing it out. I just wrote this up in the simplest way but I do like the idea of adding a checkbox. That’s something I may end up doing. Good suggestion. 🙂
I might grab that 🙂
Sure enough, the client is now questioning whether allowing a user to change the date is a good idea :-/
Hey Colin. It’ll be here if you need it!