I have created a Parent List that has a multiple selection checkbox for "Media Type". If a user chooses multiple media types, I want user to add a quantity to each media type selected. I am using SharePoint 2010. I am a novice so I am somewhat limited to SPD, InfoPath and using "simple" code of the brilliant SP developers from internet searches. Assistance is appreciated.
The problem is that SharePoint lists work in single rows and don't allow multiple complex sub records for individual items. It's a huge limitation that still exists in 2013 and I can't see anything in the road map that suggests this basic need will be introduced in the next version.
I would advise against InfoPath because it's been deprecated. I would similarly advise against modifying the list form views themselves as this can lead to any number of strange quirks.
Single list approach (making several assumptions):
- In your list include columns for Customer Name (Peron or Group, or Single Line of Text if not in AD), Order Date (Date and Time), Media (Choice->Checkbox) and Quantity (Number).
- Create a new view and Group by Customer Name, order by Created.
- Create a new page in the same site and name it Orders or whatever is appropriate.
- Add a Script Editor web part to the page and either embed or link to (preferred) your code.
Your code would include a form with Customer Name and Order Date, and a table with a row for each Media Types (and Quantity) underneath. Each row in this table will represent a new item (row) in your list.
Use the ClientContext library to lookup the list. Generate the table above by querying the list's Media field and creating a new row for each value. The Quantity field is just a plain input field.
Use jQuery to iterate over the table rows and create an object array for each row that contains a Quantity. You'd also want to validate these fields to ensure a valid numeric value.
Then just create a new list item for each row returned.
Clearly it's outside the scope of this reply to include fully-functional code without actually building the solution. But the example below should hopefully give you a head start.
Out-of-the-box having such behavior is not offered by any component. You could however opt for:
- Change the Edit form into an InfoPath and rely on few Action rules and Formatting rules you could decide to toggle visibility on the "Media-Type" to store data, see here to get started http://allcomputers.us/windows_server/infopath-with-sharepoint-2010---use-the-edit-form-on-the-list-page.aspx and here to Show/Hide fields based on conditions http://office.microsoft.com/en-us/infopath-help/hide-or-disable-a-control-based-on-values-in-a-form-HP001096364.aspx
In both cases, you should probably create additional columns for each quantity you need to store per record.