Add new item to antoher site list

Discussions about Forms Designer for SharePoint 2010.
Locked
User avatar
Sebastian Haugland
Posts: 43
Joined: Fri Sep 19, 2014
Contact:

28 Apr 2015

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)

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

29 Apr 2015

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.

User avatar
Sebastian Haugland
Posts: 43
Joined: Fri Sep 19, 2014
Contact:

29 Apr 2015

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.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

29 Apr 2015

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:

Code: Select all

window.my_global_func = function() {

}
Next, you will be able to use this function in OnClick handlers:

Code: Select all

my_global_func();

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests