Passing Multiple Choice values in Related Items
Hi,
I've set up a related items edit form. In my javascript I have:
fd.updateDroppedDocuments('.related-docs', {
Tags: fd.field('Tags').value(),
ShortDescription: fd.field('ShortDescription').value(),
Location: fd.field('Location').value(),
Photographer: fd.field('Photographer').value(),
Title: fd.field('Title').value()
});
I have 2 lists (a custom list, and a document library list), both have Tags with identical multiple choice values. I can pass over the Title, Location, Photographer fields over to document library fine, but Tags is blank and not checked.
How can I pass the Tags over to the document library list?
I've set up a related items edit form. In my javascript I have:
fd.updateDroppedDocuments('.related-docs', {
Tags: fd.field('Tags').value(),
ShortDescription: fd.field('ShortDescription').value(),
Location: fd.field('Location').value(),
Photographer: fd.field('Photographer').value(),
Title: fd.field('Title').value()
});
I have 2 lists (a custom list, and a document library list), both have Tags with identical multiple choice values. I can pass over the Title, Location, Photographer fields over to document library fine, but Tags is blank and not checked.
How can I pass the Tags over to the document library list?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
What's the type of Tags field? - Choice with checkboxes?
What's the type of Tags field? - Choice with checkboxes?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
Please, try this:
Please, try this:
Code: Select all
fd.updateDroppedDocuments('.related-docs', {
Tags: fd.field('Tags').control()._el()
.find('input:checked')
.map(function(){ return $(this).parent().find('label').text() })
.get()
.join('; '),
ShortDescription: fd.field('ShortDescription').value(),
Location: fd.field('Location').value(),
Photographer: fd.field('Photographer').value(),
Title: fd.field('Title').value()
});
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
You're right, my mistake. The code must be:
Use ;# as a separator of the selected options.
Code: Select all
fd.updateDroppedDocuments('.related-docs', {
Tags: fd.field('Tags').control()._el()
.find('input:checked')
.map(function(){ return $(this).parent().find('label').text() })
.get()
.join(';#'),
ShortDescription: fd.field('ShortDescription').value(),
Location: fd.field('Location').value(),
Photographer: fd.field('Photographer').value(),
Title: fd.field('Title').value()
});
-
- Information
-
Who is online
Users browsing this forum: No registered users and 22 guests