Please Note: We are no longer using forums to facilitate standard support. 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.

Read Only Fields

  1. tonyallsopp
    Member

    Can any please please please guide me as to how to set a field (or multiple fields) to be read only? I've read a couple of posts on here where you've directed people to a form post on stackoverflow.com (http://stackoverflow.com/questions/1362153/how-can-i-use-jquery-to-make-an-input-readonly), but I can't figure out how or where to put the couple of little code snippets they suggest.
    It would be great long-term if GF could add a simple check-box option to each field, where you could specify a field to be read only, but short-term, is there any chance of a little bit more help here? I'm sure there would be many other (non-coding) people out there that would find this helpful as well.
    Many, many thanks in advance,
    Tony

    Posted 3 years ago on Wednesday September 21, 2011 | Permalink
  2. Hi Tony,

    Here is a code snippet that will make any input field read only. Just added the class "readonly" to the settings for that field.

    You should paste this code in your theme's functions.php file:

    http://pastie.org/2570860

    Posted 3 years ago on Wednesday September 21, 2011 | Permalink
  3. David,
    Thank you for the script, it works great. The only issue is if the the form isn't valid, and throws up a validation error message, the field become writable again.

    Any ideas how I can stop this from happening?

    Posted 3 years ago on Thursday March 1, 2012 | Permalink
  4. Hi mgyura,

    Give this a shot:

    http://pastie.org/3536412

    Posted 3 years ago on Tuesday March 6, 2012 | Permalink
  5. kayrum
    Member

    Hi David

    Your function works great when using in a simple form but, when included in the functions.php on a multi page form it hides the whole form (page is blank)

    Posted 2 years ago on Monday October 1, 2012 | Permalink
  6. @kayrum, please post a link to the page with your form embedded so we can take a look. Sounds like you have a JavaScript or jQuery error.

    Posted 2 years ago on Monday October 1, 2012 | Permalink
  7. kayrum
    Member

    Hi Chris

    Yes it was a javascript issue, which I sorted by only calling the script on the specific page the form shortcode was in.

    Thanx for your comment.

    Posted 2 years ago on Friday October 5, 2012 | Permalink
  8. Thanks for the update @kayrum.

    Posted 2 years ago on Saturday October 6, 2012 | Permalink

This topic has been resolved and has been closed to new replies.

Support Tickets

Open A New Support Ticket
 Open A New Priority Support Ticket *

* Developer license holders only