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.

Hide "United States" when address type of US is selected

  1. nes49
    Member

    I'm using your advanced Address field.
    I set the address type to "United States" and the country text box doesn't appear on the form.

    However, "United States" does appear in the confirmation page (using {all_fields}).

    It doesn't seem to be wrapped with a CSS selector so I can hide it -- and it is redundant so I'd like to do that.

    Any suggestions? or is this a "feature request"?

    Posted 11 years ago on Monday March 18, 2013 | Permalink
  2. This will be much easier in 1.7 (currently in beta) with the new gform_notification filter: http://www.gravityhelp.com/documentation/page/Gform_notification

    However, until then, you can use the gform_merge_tag_filter http://www.gravityhelp.com/documentation/page/Gform_merge_tag_filter

    Insert this code into your theme's functions.php: http://pastebin.com/0dx3ub0D The code presumes the address field is field 1, on line 6. Change that to the field ID for your address field.

    There are a couple of shortcomings with this approach. There is still a line-break added to the notification email. This will apply to any instance of "United States" in any address field, when {all_fields} is used. As I said, it will be easier and more possible to take care of cleanly in 1.7. But for now, maybe this approach will work for you.

    Posted 11 years ago on Monday March 18, 2013 | Permalink
  3. nes49
    Member

    I'm still learning my way around Gravity Forms, and that was a helpful example.

    I may add this to the code I've already got to filter gform_confirmation (see this post:
    http://www.gravityhelp.com/forums/topic/how-to-append-content-to-a-confirmation-page)

    or just live with it until 1.7.

    Thanks!

    Posted 11 years ago on Monday March 18, 2013 | Permalink
  4. OK. Good luck.

    Posted 11 years ago on Tuesday March 19, 2013 | Permalink