Page 1 of 1

additional property on dropped documants

Posted: 29 Jun 2016
by rab
Hello,

I have a small question about the related items, dropped documents function. we have a form with dropped documents inside. So we fill a relationship with the fd.updateDroppedDocuments function.

Can I add an additional property from the parent form to the dropped document? We use this code:

fd.updateDroppedDocuments('.transferdocs', {
Teilnehmernr: GetUrlKeyValue('ID')

});

Thanks a lot.

RAB

Re: additional property on dropped documants

Posted: 30 Jun 2016
by Dmitry Kozlov
Hi RAB,

Sure, here is a sample:

Code: Select all

var replacements = {
    Teilnehmernr: GetUrlKeyValue('ID'),
    Field1: fd.field('Field1').value()
}

fd.updateDroppedDocuments('.transferdocs', replacements);

// If the Field1 has changed
fd.field('Field1').change(function () {
    replacements.Field1 = fd.field('Field1').value();
});


Get more info:

http://spform.com/forms-designer- ... ick-upload
http://spform.com/documentation/js/manager

Re: additional property on dropped documants

Posted: 30 Jun 2016
by rab
Hello Dimitry,

thank you for your answer. It works perfekt, if I switch to the edit mode. So I have try to modify your code like this:

var replacements = {
Teilnehmernr: GetUrlKeyValue('ID'),
Field1: fd.field('Field1').control()._el().text() // also .value()
}

fd.updateDroppedDocuments('.transferdocs', replacements);

But it didn't work. My Field1 is a cross-site lookup column.

Thank you for your help.

rab

Re: additional property on dropped documants

Posted: 01 Jul 2016
by Dmitry Kozlov
Please, try this:

Code: Select all

var href = fd.field('Field1').control()._el().find('a').attr('href');

var replacements = {
	Teilnehmernr: GetUrlKeyValue('ID'),
	Field1: fd.getUrlParam(href, 'ID')
}