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.

Extending form settings

  1. sciamannikoo
    Member

    This is a followup of this post.

    Right now I've managed to add a new setting in the form general settings (so this is not a new field type, but a form property).

    I've tried to do this following the example provided for the 'gform_field_standard_settings' hook.

    After struggling for a while and trying to understand how standard form's settings work, I've realized that this hook implementation must be different, even though the docs says "This hook functions identically to the gform_field_standard_settings hook.".

    Anyway, what I think I've understood is that rather than using the SetFieldProperty() javascript function, I must use UpdateFormProperty().

    However, the value is not stored.
    Debugging this function I see that it tries to set the html content of "#gform_" + name (where "name" is the property name I've created), but this element doesn't exists.

    Here's a sample: http://pastie.org/5412888

    I'm really lost: I've spent the last 4 hours trying to sort out what I'm doing wrong and the official documentation is not really helping.

    Posted 12 years ago on Wednesday November 21, 2012 | Permalink
  2. Sorry about that. I do think we need some more examples on form settings.
    What you need to do is use the "gform_before_update" javascript hook to save your form settings.
    Something like:

    function gform_before_update(form){
        form["my_setting"] = jQuery("#mysetting").val();
    }

    I hope this helps.

    Posted 12 years ago on Wednesday November 21, 2012 | Permalink
  3. sciamannikoo
    Member

    Hi Alex.

    Thank you for your answer.

    This definitely looks promising, but how I'm supposed to hook to 'gform_before_update'?

    Posted 12 years ago on Wednesday November 21, 2012 | Permalink
  4. sciamannikoo
    Member

    Found it!

    Here's a good working example by the way: http://pastie.org/pastes/3887415

    Alex, I've read many times official apologies about the lack of documentation for developers.
    I've spent most of this day trying to find how to do such a simple thing and also with your help I've eventually managed to get this additional form setting I was looking for.

    But frankly I'd expect to see some actual action.

    I'll probably write about it in my blog, for helping others with my same needs, and I've seen other posts referring to external resources (provided also from admins/staff like you): this doesn't make look GF very prone on providing good documentation to their users.

    I hope in actual improvements soon, but I don't have high expectations about this.

    At least there is this good support area that (most of the times at least) provides quick help.

    Posted 12 years ago on Wednesday November 21, 2012 | Permalink