• Resolved funsail

    (@funsail)


    There’s no way to set field name, which I don’t understand. It always generates a name like

    <input id=”nf-field-6″ name=”nf-field-6″ class=”ninja-forms-field nf-element” value=”53987″ type=”hidden”>

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Justin McElhaney

    (@jmcelhaney)

    Under the Administration settings for the Hidden field you can view the Field Key and set an Admin Label for the field. https://goo.gl/NdDeEX

    This does not appear to work.

    Deep within /ninja-forms/includes/Templates/fields-hidden.html, the template does not allow for the “name” attribute (or “id”) of a hidden field to be anything but nf-field-{{{ data.id }}}

    Full code from fields-hidden.html:

    
    <script id="tmpl-nf-field-hidden" type="text/template">
        <input type="hidden" id="nf-field-{{{ data.id }}}" name="nf-field-{{{ data.id }}}" class="{{{ data.renderClasses() }}} nf-element" type="text" value="{{{ data.value }}}" {{{ data.renderPlaceholder() }}}>
    </script>
    

    Furthermore, it would be better if within /ninja-forms/includes/Fields/Hidden.php, NF_Fields_Hidden had ‘custom_name_attribute’ in its settings so that something like…

    
    "{{ data.custom_name_attribute || 'nf-field-' + data.id }}"
    

    …would be possible, as is done in /ninja-forms/includes/Templates/fields-textbox.html

    I would not say this is resolved.

    I am having the same issue as the above two posters. The instructions provided by Justin only seem to change how you reference the field later on within Ninja Forms (ie. {field:<admin-label>}. The input itself still has a name formatted like nf-field-#.

    This is preventing me from integrating with the tracking code for the CRM one of my clients is using, which requires the input field to have a specific name so it can change it via javascript.

    Any updates on this? I’m trying to do the same thing and add a hidden field code from Zoho CRM into one of my Ninja Forms:

    <input type=’hidden’ id=”zc_gad” name=”zc_gad” value=””/>

    so I can track who is clicking on my Google ads. There’s got to be a way to do this..

    Thread Starter funsail

    (@funsail)

    No there’s no way. The style is to use custom names instead of standard names for things.

    Whatever you do it still generates
    <input value="" class="ninja-forms-field nf-element" id="nf-field-1" name="nf-field-1" aria-invalid="false" aria-describedby="nf-error-1" aria-labelledby="nf-label-field-1" required="" type="text">

    Hello, you are so close from the solution ??

    Just edit the templates in yourtheme/ninja-forms/templates, and use : {{{ data.key }}} for instance :
    data-key=”{{{ data.key }}}”

    but you can also add it in class or where you prefer.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘ninja forms can’t set hidden field name’ is closed to new replies.