Related Documents via browse and upload
I enjoy the ease of use of the fd.updateDroppedDocuments function in Forms Designer. Im wondering if theres a way to incorporate the ability for a user to use the standard browse function to find and then upload a file, if they prefer the old method to dragging and dropping.
It would be great to have the option to click on a button to browse for chosen file(s) to upload, then for the form to pre-fill the values in the same way the current fd.updateDroppedDocuments function does.
It would be great to have the option to click on a button to browse for chosen file(s) to upload, then for the form to pre-fill the values in the same way the current fd.updateDroppedDocuments function does.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
You can pre-populate fields on the edit form of a document right after uploading by using the code below:
Replace 'TargetField' and 'SourceField' with the internal names of the appropriate field in the parent and child forms.
You can pre-populate fields on the edit form of a document right after uploading by using the code below:
Code: Select all
fd.field('TargetField').value(window.top.fd.field('SourceField').value());
Ive been trying to get this working. Ive inserted the following into the Javascript panel in SPForm for the Edit Form in the document library:
fd.field('AWO').value(window.top.fd.field('ID').value());
But it doesnt seem to carry through to the edit form after uploading. As the AWO field is a lookup field (lists all Parent records) could this be causing the issue? Im using the Related Items control in the parent form, filtering documents that share the same 'AWO' value from the document library. Ive set the control to Editable, then using the 'Upload' button to upload a new associated document.
Once the file is uploaded it redirects to the edit form, but the code above doesnt seem to populate the AWO field.
Also, I dont know if this would be a factor, but the parent form is opening in a dialog, not full page.
fd.field('AWO').value(window.top.fd.field('ID').value());
But it doesnt seem to carry through to the edit form after uploading. As the AWO field is a lookup field (lists all Parent records) could this be causing the issue? Im using the Related Items control in the parent form, filtering documents that share the same 'AWO' value from the document library. Ive set the control to Editable, then using the 'Upload' button to upload a new associated document.
Once the file is uploaded it redirects to the edit form, but the code above doesnt seem to populate the AWO field.
Also, I dont know if this would be a factor, but the parent form is opening in a dialog, not full page.
After some more testing, using the following works to get the parent ID at least:
fd.field('AWO').value(fd.getSourceID());
It would be great to get more than just the ID from the parent form to populate the child form though. Any help would be much appreciated.
fd.field('AWO').value(fd.getSourceID());
It would be great to get more than just the ID from the parent form to populate the child form though. Any help would be much appreciated.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
Try to open the parent form in the main window (not in a dialog).
Try to open the parent form in the main window (not in a dialog).
The users of the system prefer the forms opening in dialog vs full window. Is there any way I can still pass values on to the child form after document upload? As I mentioned, I'm able to get the parent ID to pull through, just unsure how to get any other values.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
If a user opens both forms in dialogs, you can use the following code to retrieve field values from the first dialog:
var iframes = $('iframe.ms-dlgFrame', window.top.document);
var parentFD = iframes[0].contentWindow.fd;
alert(parentFD.field('Title').value);
Another option is getting field values via JSOM:
https://msdn.microsoft.com/en-us/librar ... e.14).aspx
var iframes = $('iframe.ms-dlgFrame', window.top.document);
var parentFD = iframes[0].contentWindow.fd;
alert(parentFD.field('Title').value);
Another option is getting field values via JSOM:
https://msdn.microsoft.com/en-us/librar ... e.14).aspx
-
- Information
-
Who is online
Users browsing this forum: No registered users and 6 guests