Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Parent List has a lookup with multiple promotional items. Once user chooses a promotional item, I want user to be able to add a quantity to that specific item. User should be able to select Multiple items, and assign unique quantities to each item. Any help would be great!!

share|improve this question

2 Answers 2

up vote 3 down vote accepted

I would suggest to consider the following solution:

  1. Create a list "Quantities" with three columns: Title, Promotional item, Quantity. The Promotional item column, obvioulsy, is the lookup to the list with promotional items.
  2. Create a multilookup column Items with quantities in the Parent List, which points to Title column of the "Quantities" list
  3. Create a special control for editing the Items with quantities column (see details below)
  4. Using custom ListFieldIterator, override standard control with your custom control.

The most curious thing here is the mentioned custom control for displaying "Items with quantities" column. It would look something like this:

enter image description here

When you press -> button, the control should create a new item in the "Quantities" list, by using EcmaScript client object model, and set initial values as follows:

  1. Title = PromotionalItemTitle + "(" + DefaultQuantity + ")"
  2. Quantity = DefaultQuantity
  3. Promotional item = PromotionalItemId

Each time you change quantity, the control must update the corresponding item in the "Quantities" list, following way:

  1. Title = PromotionalItemTitle + "(" + NewQuantity + ")"
  2. Quantity = NewQuantity
  3. Promotional item remains unchanged

Thus, since the Items with quantities column is linked to the Title column of the "Quantities" list, values of this column will be displayed by default as "[Title] ([Quantity])", this is I assume quite acceptable. Hence, you will be able to avoid any display customizations.

share|improve this answer
    
This is great!! any guidance on creating custom control. Yes I am new to sharepoint dev... I am also working in Sharepoint Designer, do I need to create custom controls in Visual Studio first? then apply them in Designer? –  Brenton Pierce Feb 3 '12 at 19:59
    
Brenton, I think it's possible to implement this solution even without Visual Studio. You can create custom edit and new forms, and with help of js (or better jquery) improve the original, OOTB multilookup control, adding handlers to it's buttons and overriding it's right select with some cool div. –  Andrey Markeev Feb 3 '12 at 20:18
    
I think that is a great solution. However, I am not even sure where to begin with the editing of this form. I am well versed with jquery, but where does one even get to the code from designer?? Sorry in advance for the hand holding!! –  Brenton Pierce Feb 3 '12 at 20:24
    
You can add a custom jQuery to any list form by switching the form page into Edit mode, adding Content Editor WebPart to the page, and then adding <script> tag there. To achieve this, you will need to edit HTML source (Ribbon -> Editing tools -> Format Text tab -> HTML -> Edit HTML source) –  Andrey Markeev Feb 3 '12 at 20:45
    
Ok, I am in there, Do i need to call the "ListFieldIterator" class in this layout, or is that a property i set in the multiple lookup? –  Brenton Pierce Feb 3 '12 at 20:51

In order to do this you would have to add the following components:

  • A third list containing lookups to the other two lists, and the quantity.
  • A custom form on the parent list to display the add/edit interface, and update the third list.
  • A custom form on the parent list to view the item, and related items/quantities

But this would still not display the quantities on the list view.

Alternatively, you could create a multi-valued Custom Field Type to handle input and display, but this is is likely to be even more difficult.

share|improve this answer
    
These are good thoughts, I will explore some of these options. –  Brenton Pierce Feb 3 '12 at 17:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.