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.

change field names for first and last name

  1. rotundaservices
    Member

    On our site where we use Gravity Forms, we support three languages; French, English and Spanish.

    I would like to know how to change the "first" and "last" labels of an advanced name field.

    Currently I can change everything except this.

    Posted 13 years ago on Monday April 18, 2011 | Permalink
  2. You can do that with a filter.

    http://www.gravityhelp.com/forums/topic/field-name-first-and-last#post-18600

    Posted 13 years ago on Monday April 18, 2011 | Permalink
  3. Are you using any kind of translation plugin such as WPML? If not you should check out this add-on for WPML:

    http://wpml.org/documentation/related-projects/gravity-forms-multilingual/

    If you want to manually do it you can do so using custom PHP you add to your themes functions.php file. The sublabel hooks are documented here:

    http://www.gravityhelp.com/documentation/page/Developer_Docs#Sublabels

    Posted 13 years ago on Monday April 18, 2011 | Permalink
  4. rotundaservices
    Member

    @Kevin, I've tried to use the filter and I'm not having much success with this at all. I tried adding the functions to my functions.php

    How do I differentiate between two forms on the site. One I want to keep in English, the two others I need to localise to French and Spanish (although they are the same form).

    @Carl, I don't use a translation plugin. Ideally I'd like to code this inside Gravity so that I'm not dependent on future updates of another secondary plugin.

    Posted 13 years ago on Tuesday May 17, 2011 | Permalink
  5. Are you trying to do this with one form?

    You would have to have 3 different forms. Create one in English, the 2nd in French and the 3rd in Spanish.

    The sublabel filters that Kevin provided a link for do work, so if they aren't working it's going to be due to how you implemented them. You differentiate which form you are targeting with those filters by appending the form id of the form you want to target to the filter call.

    For instance this would apply the change globally to all forms:

    add_filter("gform_name_first", "change_name_first", 10, 2);
    function change_name_first($label, $form_id){
        return "First Name";
    }

    And this would only apply the label change to ONLY Form ID 5:

    Are you trying to do this with one form?

    You would have to have 3 different forms. Create one in English, the 2nd in French and the 3rd in Spanish.

    The sublabel filters that Kevin provided a link for do work, so if they aren't working it's going to be due to how you implemented them. You differentiate which form you are targeting with those filters by appending the form id of the form you want to target to the filter call.

    For instance this would apply the change globally to all forms:

    add_filter("gform_name_first_5", "change_name_first", 10, 2);
    function change_name_first($label, $form_id){
        return "First Name";
    }

    So you append the form id to the end of the filter (ex. gform_name_first_5).

    If you can show us the code you are using we can take a look. You can copy-n-paste your code at http://www.pastie.org/ and provide the link here and we can take a look.

    Posted 13 years ago on Tuesday May 17, 2011 | Permalink
  6. rotundaservices
    Member

    This makes sense, I'm dyslexic which puts me on bad footing to start with!

    I didn't see the immediate difference between "gform_name_first" and "gform_name_first_5"

    oy... going to add this now and will report back some success! hopefully...

    Posted 13 years ago on Tuesday May 17, 2011 | Permalink
  7. rotundaservices
    Member

    Happy to report this is all working well! Thanks very much for the help.

    Posted 13 years ago on Tuesday May 17, 2011 | Permalink

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