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.

Read-only Field Help / Dynamically Populate a Section Break

  1. theslink2000
    Member

    Hi, apologies in advance for the long post.

    I've been trying to find a simple way to make a GForms fields ready only and visible so simply hiding it through CSS is not an option. After a LOT of searching the only real solution posted in these forums seems to be to use Javascript, and even when looking at the tutorials I can't make head's or tails of it.

    Basically I want a user to enter their postal address on the first page of a multi-part form and then on the second the form will display their assigned user ID comprising of the postcode and the next available three digit number. This is simple enough, but making that field read only is proving a nightmare. I assumed it would be a simple built-in feature, or if not I could dynamically populate a label or something of the like (may I suggest adding some functionality along these lines in future, as having labels available for displaying data would be massively helpful. I know this isn't the main focus of GForms but still, it seems simple and can only strengthen an already great product).

    Eventually I stumbled upon this plugin / tutorial -

    http://wpsmith.net/2011/plugins/how-to-create-a-custom-form-field-in-gravity-forms-with-a-terms-of-service-form-field-example/

    Which seemed to offer the answer, however no matter what I try when I change the field format from a textarea to a single line text box it starts doing weird things such as putting the field data outside of the box or just not appearing at all. I've tried asking the plugin / tutorial maker but it's been over a month now and nothing.

    So after reading up on how to use a Section Break to create a Terms and Conditions field here -

    http://www.gravityhelp.com/forums/topic/how-do-i-make-a-textarea-field-un-editable

    I wondered if the same idea could work to solve my problem. My form uses the CSS class to know which field to dynamically populate as outlined on these forums (lost the link, sorry) so it makes sense that it should be possible but I can't make it work.

    Does anyone have any solutions to either of these problems, ideally the first I suppose as it seems much easier.

    Many thanks.

    Posted 12 years ago on Saturday July 7, 2012 | Permalink
  2. FanaticWeb
    Member

    +1 for the Read only field assignments, this can also be applied to a Members only submissions, kind of silly if they can modify their pre-populated usernames and emails and other related data.

    Posted 12 years ago on Saturday July 7, 2012 | Permalink
  3. theslink2000
    Member

    Exactly my thoughts bud, from what I've been reading it's only a bit of Javascript so to turn it into a check box in the options of a field surely shouldn't be that hard for a skilled developer.

    Posted 12 years ago on Sunday July 8, 2012 | Permalink
  4. theslink2000
    Member

    Kind of a bump but I've got something to add as well.

    I've managed to get my whole form to populate hidden post fields on the same page using this JQuery http://pastie.org/4230744 but the field I've described to start with (the textarea, read only field) doesn't work with this. The reason being it is dependent on the source field being clicked in to fire the script, if you click on the field first it will the populate when you click again (anywhere). I'm sure there's something I can do with the gform_pre_submission hook but I can't get anywhere with it.

    Anyone got any ideas?

    Posted 12 years ago on Wednesday July 11, 2012 | Permalink
  5. theslink2000
    Member

    Ok whilst I never got a reply from an admin I have managed to get a working solution.

    I couldn't get this to work to start with but after going back to it as a last resort after not getting a response here I have managed to get it functioning this time.

    http://www.gravityhelp.com/forums/topic/terms-and-conditions-text-record-in-form-entries-database#post-25225

    So combine that with the dynamic population between pages I outlined in my last post I have a working solution.

    Posted 12 years ago on Friday July 13, 2012 | Permalink