Answers.Body: <p>Whenever you submit forms to Craft, your <code>name</code> attribute must be formatted in a certain way by adding your values to a <code>fields[]</code> array. In your case, the field should look like:</p>
  
  <p><code>&lt;input type="hidden" name="fields[nomDocumentEfficy]" value="my_value"&gt;</code></p>
  
  <p>You can see this happening if you ever inspect a form field inside an entry in the CMS, or if you inspect the output generated by amforms' tags you're using: <code>{{ form.displayField('email') }}</code></p>
  
  <p><strong>However</strong>, <em>not all form field types get added to this array the same as a simple <code>text</code> or <code>hidden</code> field!</em> For reference on how to format <code>checkbox</code> fields, <code>date</code> fields, or even Matrix fields, for example, you can reference this great guide on <a href="https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input" rel="nofollow noreferrer">StraightUpCraft</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-12T21:21:54.957Z
Answers.LastActivityDate: 2017-09-12T21:21:54.957Z
Answers.UserDisplayName: Ryan
Body: <p>I've created a form using amforms to ask some info about the visitor when he request a document.<br>
  I want to pass the name of the requested document in the form.</p>
  
  <p>So I created the field <code>nomDocumentEfficy</code> and attached it to my form but I cannot get the value in my submitted forms.</p>
  
  <p>Here is my form :</p>
  
  <pre><code>&lt;div class="form-askemail contact"&gt;
      {{ getCsrfInput() }}
  
      {# This should always be here! #}
      &lt;input type="hidden" name="action" value="/amForms/submissions/saveSubmission"&gt;
  
      {# Insert your form's handle. #}
      &lt;input type="hidden" name="handle" value="{{ form.handle }}"&gt;
  
      {# This will namespace your inputs (for IDs and such), but it's not required though #}
      &lt;input type="hidden" name="namespace" value="{{ form.getNamespace() }}"&gt;
  
      {# Optional: Redirect URL. Will redirect to current page by default. #}
      &lt;input type="hidden" name="redirect" value="{{ craft.request.getParam('redirect') }}"&gt;
  
      {# Optional: Anti-spam protection. #}
      {{ craft.amForms.displayAntispam() }}
  
      {# Optional: Google reCAPTCHA protection. #}
      {{ craft.amForms.displayRecaptcha() }}
  
      {# Place the HTML of your fields here #}
      {{ form.displayField('email') }}
      {{ form.displayField('societe') }}
      {{ form.displayField('typeEtablissementAskEmailForm') }}
      {{ form.displayField('numeroDepartement') }}
  
      {# Hidden input field with my value #}
      &lt;input type="hidden" name="nomDocumentEfficy" value="my_value"&gt;
  &lt;/div&gt;
  </code></pre>
  
Tags: <plugin-amforms>
Title: Passing value in form with amforms plugin
ThreadText: # Passing value in form with amforms plugin
  
  (Asked by: username_0 on 2017-05-26)
  
  I've created a form using amforms to ask some info about the visitor when he request a document.  
  I want to pass the name of the requested document in the form.
  
  So I created the field `nomDocumentEfficy` and attached it to my form but I cannot get the value in my submitted forms.
  
  Here is my form :
  
  ```
  <div class="form-askemail contact">
      {{ getCsrfInput() }}
  
      {# This should always be here! #}
      <input type="hidden" name="action" value="/amForms/submissions/saveSubmission">
  
      {# Insert your form's handle. #}
      <input type="hidden" name="handle" value="{{ form.handle }}">
  
      {# This will namespace your inputs (for IDs and such), but it's not required though #}
      <input type="hidden" name="namespace" value="{{ form.getNamespace() }}">
  
      {# Optional: Redirect URL. Will redirect to current page by default. #}
      <input type="hidden" name="redirect" value="{{ craft.request.getParam('redirect') }}">
  
      {# Optional: Anti-spam protection. #}
      {{ craft.amForms.displayAntispam() }}
  
      {# Optional: Google reCAPTCHA protection. #}
      {{ craft.amForms.displayRecaptcha() }}
  
      {# Place the HTML of your fields here #}
      {{ form.displayField('email') }}
      {{ form.displayField('societe') }}
      {{ form.displayField('typeEtablissementAskEmailForm') }}
      {{ form.displayField('numeroDepartement') }}
  
      {# Hidden input field with my value #}
      <input type="hidden" name="nomDocumentEfficy" value="my_value">
  </div>
  
  ```
  
  **Tags:** plugin-amforms
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-09-12. Score: 1
  
  Whenever you submit forms to Craft, your `name` attribute must be formatted in a certain way by adding your values to a `fields[]` array. In your case, the field should look like:
  
  `<input type="hidden" name="fields[nomDocumentEfficy]" value="my_value">`
  
  You can see this happening if you ever inspect a form field inside an entry in the CMS, or if you inspect the output generated by amforms' tags you're using: `{{ form.displayField('email') }}`
  
  **However**, *not all form field types get added to this array the same as a simple `text` or `hidden` field!* For reference on how to format `checkbox` fields, `date` fields, or even Matrix fields, for example, you can reference this great guide on [StraightUpCraft](https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input).
  
  
  ---
  
  