PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How to set disabled="disabled" for form input type checkbox?

  1. Hi,

    I'm trying to create a form (with a gform_pre_render filter) that would disable one or more checkboxes. In "plain" HTML, I'd expect that to be possible with the property:

    <input type="checkbox" disabled="disabled" />.

    I'm not able to locate docs describing how I could modify/add properties to fields (like a checkbox). Is that capability not available?

    Posted 6 years ago on Sunday September 16, 2012 | Permalink
  2. There is no built in functionality to disable a checkbox. You can do it with a little jQuery. I would give the select box a custom CSS class of "gform_disabled", then in your jQuery loop through all the fields and when you find that class, add the attribute of 'disabled="disabled"' (or readonly="readonly" as appropriate.)

    Here is a solution one member posted:

    Posted 6 years ago on Tuesday September 18, 2012 | Permalink