Answers.Body: <p>I don't feel I fully understand how you will be using the data on the back end, but here are some ideas.</p>
  
  <p>It sounds like the best way to solve this problem would be to build a custom field-type plugin that stored checkbox data in the way that you need it to be stored on the back end.</p>
  
  <p>A simpler workaround may be to use a multi-line Plain Text field as your "checkbox" field.  You could display things however you want to the users on the front-end, and submit the checkbox data behind the scenes in a way that stores the data in that field in a readable way.  While the data may not behave like a checklist, you would get a snapshot of the checklist items for each submission and the length of items could vary.</p>
  
  <p>To capture the User ID and To-do List ID, you might be able to use the <a href="http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/hidden-field" rel="nofollow">Sprout Hidden Field</a> or <a href="http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/invisible-field" rel="nofollow">Sprout Invisible Field</a> which would just store those IDs in a plain text field.</p>
  
  <p>If you wish to store the ID as relational data, you'll need to create the appropriate relational field (such as a Users Relations field) and submit the ID as an array:</p>
  
  <p><code>&lt;input type="hidden" name="fields[usersFieldHandle][]" value="{{ currentUser.id }}"&gt;</code></p>
  
  <p>Additional examples of inputs to submit data from the front-end can be found in the <a href="https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input" rel="nofollow">Craft Field Guide</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-22T11:17:19.770Z
Answers.Text: Thanks Ben, that's great. I'm going to have a play with that idea. Thanks for taking the time to help!
Answers.UserDisplayName: Rich Holt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-21T17:13:28.670Z
Answers.LastActivityDate: 2016-03-21T17:13:28.670Z
Answers.UserDisplayName: Ben Parizek
Body: <p>I'm using a block matrix to display items of a to-do list. </p>
  
  <p>Each item has a checkbox input. Number of items can vary.</p>
  
  <p>I'm trying to use SproutForms to save the state of the checkbox. This would need to record the currentUser and the to-do list ID. </p>
  
  <p>I've made a form within the SproutForms plugin to include a checkbox and a  to-do list ID, but how can I associate the checkbox on the to-do list item with the checkbox on the SproutForm form?</p>
  
  <p>If I were to use displayField to show the checkbox from the SproutForm, I'd have to make a checkbox for every to-do list item within the SproutForm plugin.</p>
  
  <p>I hope that makes sense! Thanks for any help.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-19T00:20:09.363Z
Comments.Text: Hey Rich. The default checkbox field requires that the field have settings regarding which checkbox items exist. It sounds like, in your situation, you just want to store an arbitrary list of tasks and that Sprout Forms may never know which tasks you need before the form is submitted. Am I understanding this correctly in that each form entry may have a completely different list of checkboxes that were submitted to it?
Comments.UserDisplayName: Ben Parizek
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-21T10:15:45.793Z
Comments.Text: Hi Ben. Yea that's the issue, it's kind of like the checkboxes are defined on the front end. I was thinking that on submitting the form, the plugin could understand what input entries to create in CP.
Comments.UserDisplayName: Rich Holt
Tags: <plugin-sproutforms>
Title: How to store value of checkboxes without predefining them in the SproutForm plugin
ThreadText: # How to store value of checkboxes without predefining them in the SproutForm plugin
  
  (Asked by: username_0 on 2016-03-14)
  
  I'm using a block matrix to display items of a to-do list.
  
  Each item has a checkbox input. Number of items can vary.
  
  I'm trying to use SproutForms to save the state of the checkbox. This would need to record the currentUser and the to-do list ID.
  
  I've made a form within the SproutForms plugin to include a checkbox and a to-do list ID, but how can I associate the checkbox on the to-do list item with the checkbox on the SproutForm form?
  
  If I were to use displayField to show the checkbox from the SproutForm, I'd have to make a checkbox for every to-do list item within the SproutForm plugin.
  
  I hope that makes sense! Thanks for any help.
  
  **Tags:** plugin-sproutforms
  
  > **Comments:**
  > **username_1**: Hey username_0. The default checkbox field requires that the field have settings regarding which checkbox items exist. It sounds like, in your situation, you just want to store an arbitrary list of tasks and that Sprout Forms may never know which tasks you need before the form is submitted. Am I understanding this correctly in that each form entry may have a completely different list of checkboxes that were submitted to it?  
  > **username_0**: Hi Ben. Yea that's the issue, it's kind of like the checkboxes are defined on the front end. I was thinking that on submitting the form, the plugin could understand what input entries to create in CP.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-21. Score: 0 | Accepted answer
  
  I don't feel I fully understand how you will be using the data on the back end, but here are some ideas.
  
  It sounds like the best way to solve this problem would be to build a custom field-type plugin that stored checkbox data in the way that you need it to be stored on the back end.
  
  A simpler workaround may be to use a multi-line Plain Text field as your "checkbox" field. You could display things however you want to the users on the front-end, and submit the checkbox data behind the scenes in a way that stores the data in that field in a readable way. While the data may not behave like a checklist, you would get a snapshot of the checklist items for each submission and the length of items could vary.
  
  To capture the User ID and To-do List ID, you might be able to use the [Sprout Hidden Field](http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/hidden-field) or [Sprout Invisible Field](http://sprout.barrelstrengthdesign.com/craft-plugins/fields/docs/overview/invisible-field) which would just store those IDs in a plain text field.
  
  If you wish to store the ID as relational data, you'll need to create the appropriate relational field (such as a Users Relations field) and submit the ID as an array:
  
  `<input type="hidden" name="fields[usersFieldHandle][]" value="{{ currentUser.id }}">`
  
  Additional examples of inputs to submit data from the front-end can be found in the [Craft Field Guide](https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input)
  
  > **Comments:**
  > **username_0**: Thanks Ben, that's great. I'm going to have a play with that idea. Thanks for taking the time to help!  
  
  ---
  
  