Answers.Body: <p>A suggestion from Freeform support:</p>
  
  <blockquote>
    <p>The only way you might be able to achieve this would be if you used a regular Text field (inside of Composer), and then override the formatting template to manually render the field as a select dropdown and populate the options dynamically. Actual fields with options such as Select fields need to have all of their options pre-defined inside Composer, which is why it wouldn't work otherwise. Using the element populators could almost get you there, but it doesn't allow dynamic filtering like what you'd need.</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-26T15:21:28.577Z
Answers.LastActivityDate: 2019-04-26T15:21:28.577Z
Answers.UserDisplayName: Amanda Lutz
Body: <p>Pretty much a duplicate of <a href="https://craftcms.stackexchange.com/questions/29118/freeform-accessing-a-fields-customattributes">FreeForm: Accessing a fields customAttributes</a> but to answer Solspace's comment "Can you think of a use-case where you would apply attributes to a field but then render those manually?", yes I can.</p>
  
  <p>My current project has Company entries and Equipment entries. Each user belongs to a single Company.</p>
  
  <p>When a user fills out a form with a select field where source=entries and target=Equipment, I don't want the user to see all equipment in the system. Only equipment belonging to user's company.</p>
  
  <p>I thought a clever idea would be to add field class "filterEquipment". When rendering my form </p>
  
  <ul>
  <li>if field.type=select and field class contains "filterEquipment" I want to loop through field options and only display equipment that belongs to user's company</li>
  <li>else render select field as normal</li>
  </ul>
  
  <p>I'm open to other suggestions.</p>
  
Tags: <plugin-freeform><solspace>
Title: FreeForm fields: Need access to customAttributes
ThreadText: # FreeForm fields: Need access to customAttributes
  
  (Asked by: username_0 on 2019-04-25)
  
  Pretty much a duplicate of [FreeForm: Accessing a fields customAttributes](https://craftcms.stackexchange.com/questions/29118/freeform-accessing-a-fields-customattributes) but to answer Solspace's comment "Can you think of a use-case where you would apply attributes to a field but then render those manually?", yes I can.
  
  My current project has Company entries and Equipment entries. Each user belongs to a single Company.
  
  When a user fills out a form with a select field where source=entries and target=Equipment, I don't want the user to see all equipment in the system. Only equipment belonging to user's company.
  
  I thought a clever idea would be to add field class "filterEquipment". When rendering my form
  
  * if field.type=select and field class contains "filterEquipment" I want to loop through field options and only display equipment that belongs to user's company
  * else render select field as normal
  
  I'm open to other suggestions.
  
  **Tags:** plugin-freeform, solspace
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-04-26. Score: 1 | Accepted answer
  
  A suggestion from Freeform support:
  
  > The only way you might be able to achieve this would be if you used a regular Text field (inside of Composer), and then override the formatting template to manually render the field as a select dropdown and populate the options dynamically. Actual fields with options such as Select fields need to have all of their options pre-defined inside Composer, which is why it wouldn't work otherwise. Using the element populators could almost get you there, but it doesn't allow dynamic filtering like what you'd need.
  
  
  ---
  
  