Add new item to antoher site list
- Sebastian Haugland
- Posts: 43
- Joined: Fri Sep 19, 2014
- Contact:
I have made a form in one list and in that form I would like to have a button where I can click to add an item (with predefined data) to another list in another site. Any suggestions to a script? (no user input)
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Sebastian,
You can add an item to another list with the help of JavaScript by using CSOM (or REST) and our JS-framework to retrieve values from the current form's fields.
You can add an item to another list with the help of JavaScript by using CSOM (or REST) and our JS-framework to retrieve values from the current form's fields.
- Sebastian Haugland
- Posts: 43
- Joined: Fri Sep 19, 2014
- Contact:
Thanks, but I have allready tried that - gets no error, just not working - , is this only working in SP 2013? (I am on 2010).
Could all functions be in the button script or do they have to be in the JS editor of the form? (only calling them from the button.
Could all functions be in the button script or do they have to be in the JS editor of the form? (only calling them from the button.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
This approach works in SharePoint 2010 as well:
https://msdn.microsoft.com/en-us/librar ... e.14).aspx
You can define functions globally in the general JavaScript editor of Forms Designer but you should use the following syntax:
Next, you will be able to use this function in OnClick handlers:
https://msdn.microsoft.com/en-us/librar ... e.14).aspx
You can define functions globally in the general JavaScript editor of Forms Designer but you should use the following syntax:
Code: Select all
window.my_global_func = function() {
}
Code: Select all
my_global_func();
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests