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.

Custom fields not posting properly

  1. I have built a few custom fields that have multiple inputs (First, Middle, Last, Maiden Names). It is displaying properly, and as far as I can tell the naming convention looks right...however when the form is submitted the values in the fields are not being posted. I noticed that in the $form that I got from the gform_post_submission hook, that the input for the fields was empty, while the stock form[fields][inputs] pieces all had arrays listing the different input pieces within the field. What do I need to do so that the input will properly update with the fields I want in it?

    See below for the current html of how my custom field is being put into the page.
    Thanks in advance for any help!

    Edit: Additional Info:
    To put my custom field into the interface I use gform_add_field_buttons to put it in, gform_field_type_title to give it a title and gform_field_input to modify what it looks like. For the gform_field_input function all I do is create the HTML, based on the current form id and the id of the field to build the id's and names of all the html tags.

    <div class="ginput_complex ginput_container" id="input_3_3_3">
       <span id="input_3_3_3_container">
          <input type="text" name="input_3.3" id="input_3_3_3" value="test">
          <label for="input_3_3_3"> First </label>
       </span> 
    
       <span id="input_3_3_6_container">
          <input type="text" name="input_3.6" id="input_3_3_6" value="">
            <label for="input_3_3_6"> MI </label>
       </span>
    
       <span id="input_3_3_9_container">
          <input type="text" name="input_3.9" id="input_3_3_9">
          <label for="input_3_3_9"> Last </label>
       </span>
       <span id="input_3_3_12_container">
          <input type="text" name="input_3.12" id="input_3_3_12">
          <label for="input_3_3_12"> Maiden </label>
       </span>
    </div>
    Posted 12 years ago on Thursday January 5, 2012 | Permalink
  2. I got it, after crawling through the source code I found a hook that is not mentioned in the documentation!
    For all those having the same issue, you need to define all inputs in the new field with javascript in a case that is buried in the source code. Luckily there is a hook, which can be implemented as I show below:

    <?php
    add_filter('gform_editor_js_set_default_values', 'add_custom_default_values');
    function add_custom_default_values () {
    ?>
       case "multi_input_field" :
          field.inputs = [  new Input( field.id + 0.1, '<?php echo esc_js(__("First", "gravityforms")); ?>');
                                 new Input( field.id + 0.2, '<?php echo esc_js(__("Second", "gravityforms")); ?>');
                                 new Input( field.id + 0.3, '<?php echo esc_js(__("Third", "gravityforms")); ?>');
                        ]
          break
    <?php } ?>
    Posted 12 years ago on Friday January 6, 2012 | Permalink
  3. Thank you for posting your solution.

    Posted 12 years ago on Tuesday January 10, 2012 | Permalink

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