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.

Saving a value in a gform_advanced_settings input

  1. Jive Software

    I am having a difficult time finding the documentation that explains how to hook into javascript events that prepolutate custom fields added in the gform_advanced_settings hook.

    add_action("gform_advanced_settings", "marketo_advanced_settings", 10, 2);
    function marketo_advanced_settings($position, $form_id){
    	if($position == 100) {
    				<label for="field_marketo_label">
    						<?php _e("Marketo Url", "gravityforms"); ?>
            <input type="text" id="marketo_url" class="fieldwidth-3" size="35"/>
    add_action("gform_editor_js", "editor_script");
    function editor_script(){
        <script type='text/javascript'>
    jQuery(document).bind("gform_load_field_settings", function(event, field, form) {
    					if (typeof field["marketo_url"] !== "undefined") {
    						jQuery("#marketo_url").attr("value", field["marketo_url"]);
    					} else {
    						jQuery("#marketo_url").attr("value", '');
    Posted 6 years ago on Tuesday September 11, 2012 | Permalink
  2. gform_advanced_settings are used to create custom Form settings (displayed when clicking the form title). It looks like what you want is a field setting. If that is the case, take a look at gform_field_advanced_settings (
    There is an example on that page that completely implements a field setting. I would start from that example when implementing your custom field.

    Posted 6 years ago on Wednesday September 12, 2012 | Permalink
  3. Jive Software

    Hi Alex
    Thank you for the reply. That is what I want to do "create custom Form settings (displayed when clicking the form title)". But I am having a hard time prepopulating the input text box with the data that was saved in previous posts. And I am having a hard time finding the documentation for this?

    Posted 6 years ago on Thursday September 13, 2012 | Permalink
  4. Jive Software

    Looking through the gravity js file... It seems like there is global javascript variable called "form" that prints out these properites

    button: Object
    confirmation: Object
    cssClass: ""
    description: ""
    descriptionPlacement: "below"
    enableAnimation: false
    enableHoneypot: true
    fields: Array[10]
    firstPageCssClass: null
    id: 1
    labelPlacement: "top_label"
    lastPageButton: null
    limitEntries: false
    limitEntriesCount: ""
    limitEntriesMessage: ""
    limitEntriesPeriod: ""
    maxEntriesMessage: ""
    notification: Object
    message: "{all_fields}"
    subject: "New submission from {form_title}"
    to: "{admin_email}"
    __proto__: Object
    pagination: null
    postContentTemplate: ""
    postContentTemplateEnabled: false
    postTitleTemplate: ""
    postTitleTemplateEnabled: false
    requireLogin: false
    requireLoginMessage: ""
    scheduleEnd: ""
    scheduleEndAmpm: ""
    scheduleEndHour: ""
    scheduleEndMinute: ""
    scheduleForm: false
    scheduleMessage: ""
    scheduleStart: ""
    scheduleStartAmpm: ""
    scheduleStartHour: ""
    scheduleStartMinute: ""
    title: "Contact"
    useCurrentUserAsAuthor: true
    __proto__: Object

    I am disapointed to see that after I click save the value of custom input text box is not stored in this object... It looks like I need to find the hook into this and create my own property when the user clicks save...

    I also still can not find the javascript event to hook into for the form panel... It looks like "gform_load_field_settings" is not used for the form panel...

    Posted 6 years ago on Thursday September 13, 2012 | Permalink
  5. Jive Software

    It look like this hook is better "gform_properties_settings" then "gform_advanced_settings" becuase it saves in the first tab... verse the advanced tab...

    Posted 6 years ago on Thursday September 13, 2012 | Permalink
  6. Jive Software

    I tried using UpdateFormProperty to save the form data but it looks like this just writes to a DOM object...

    function UpdateFormProperty(name, value){
        jQuery("#gform_" + name).html(value);

    Maybe I need to write a custom javascript function that adds a property to the over all form object?

    Posted 6 years ago on Tuesday September 25, 2012 | Permalink
  7. Jive Software

    How can one access the properties and methods of the form object any a hook?

    Posted 6 years ago on Tuesday September 25, 2012 | Permalink
  8. To save your custom setting, you need to save it to the global Javascript form object as the user types into your input (onkeyup) or makes a selection from a drop down (onchange). See example below.

    Gravity Forms will take it from there and make sure it is saved to your database. From the hooks that accept the $form object (most of them do, but some don't), you will then be able to access your setting by using:

    I hope this helps.

    Posted 6 years ago on Tuesday September 25, 2012 | Permalink
  9. Jive Software

    Hi Alex... Your example is for form fields but not the over all form...
    I am looking to add a property to the overall from panel not the form field panel.

    Posted 6 years ago on Tuesday September 25, 2012 | Permalink
  10. Jive Software

    That did help...

    I looks like I may be able to do this...

    1) add my own custom js function....

    function SetFormProperty(name, value){
        if(value == undefined) {
            value = "";
        form[name] = value;

    2) add something like this to prepopulate the value

    jQuery(document).bind("gform_load_form_settings", function(event, field, form) {
    					if (typeof form.marketo_url !== "undefined") {
    						jQuery("#field_marketo_url").attr("value", form.marketo_url]);
    					} else {
    						jQuery("#field_marketo_url").attr("value", '');
    Posted 6 years ago on Tuesday September 25, 2012 | Permalink
  11. pauldewouters

    Hi stvcg00

    did you manage to find a working solution? I'm struggling with this too...
    I want to save a text input, but the onkeyup gives me an error:
    cannot set property of null.

    I looked through a free addon from the repository, but it does things in a completely different way.

    Posted 6 years ago on Wednesday October 17, 2012 | Permalink