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.

Address, City field Bug with solution

  1. I am using gravity forms and using my own styles to make the forms fit my site. In doing so I found the following bug in the Address block for a form.

    When you include an address block in the form, GF plugin drops in the following code for the city field of the form (specifically the label field)

    <label for='input_1_4_3' id='input_1_4.3_label'>City</label>

    Unlike the other fields the id has a period rather than an underscore. When using CSS to style entries this creates a problem.

    The bug is in common.php in the use of a sprintf statement (line 2723 in my release) as shown below

    $city = sprintf("<span class='ginput_{$city_location}$class_suffix' id='" . $field_id . "_3_container'><input type='text' name='input_%d.3' id='%s_3' value='%s' $tabindex %s/><label for='%s_3' id='$field_id.3_label'>" . apply_filters("gform_address_city_{$form_id}", apply_filters("gform_address_city",__("City", "gravityforms"), $form_id), $form_id) . "</label></span>", $id, $field_id, $city_value, $disabled_text, $field_id);

    The recommend change is :

    $city = sprintf("<span class='ginput_{$city_location}$class_suffix' id='" . $field_id . "_3_container'><input type='text' name='input_%d.3' id='%s_3' value='%s' $tabindex %s/><label for='%s_3' id='" . $field_id . "_3_label'>" . apply_filters("gform_address_city_{$form_id}", apply_filters("gform_address_city",__("City", "gravityforms"), $form_id), $form_id) . "</label></span>", $id, $field_id, $city_value, $disabled_text, $field_id);

    Hope this helps everyone

    Loren

    Posted 7 years ago on Wednesday April 11, 2012 | Permalink
  2. To confirm.. which version of Gravity Forms are you using?

    Posted 7 years ago on Wednesday April 11, 2012 | Permalink
  3. graphical_force
    Member

    Awesome. This was driving me nuts. I am seeing this in Version 1.6.5.

    I actually changed it on line 2820 and 2836.

    Posted 6 years ago on Monday August 6, 2012 | Permalink
  4. graphical_force
    Member

    This is still an issue in v. 1.6.10. When I update, it breaks it again.

    Posted 6 years ago on Sunday December 9, 2012 | Permalink
  5. David Peralty
    Administrator

    Thanks, I'll pass this on to our developers.

    Posted 6 years ago on Monday December 10, 2012 | Permalink
  6. Thanks for the heads up. This fix will be included in 1.7.

    Posted 6 years ago on Monday December 10, 2012 | Permalink
  7. graphical_force
    Member

    Still an issue in 1.7.

    Here is what I changed to target the id of input_1_5_3_label on 6575 in the common.php file:

    original:

    $city = sprintf("<span class='ginput_{$city_location}$class_suffix' id='" . $field_id . "_3_container'><input type='text' name='input_%d.3' id='%s_3' value='%s' $tabindex %s/><label for='%s_3' id='$field_id.3_label'>" . apply_filters("gform_address_city_{$form_id}", apply_filters("gform_address_city",__("City", "gravityforms"), $form_id), $form_id) . "</label></span>", $id, $field_id, $city_value, $disabled_text, $field_id);

    fixed:

    $city = sprintf("<span class='ginput_{$city_location}$class_suffix' id='" . $field_id . "_3_container'><input type='text' name='input_%d.3' id='%s_3' value='%s' $tabindex %s/><label for='%s_3' id='" . $field_id ."_3_label'>" . apply_filters("gform_address_city_{$form_id}", apply_filters("gform_address_city",__("City", "gravityforms"), $form_id), $form_id) . "</label></span>", $id, $field_id, $city_value, $disabled_text, $field_id);
    Posted 6 years ago on Thursday April 25, 2013 | Permalink