This project has moved and is read-only. For the latest updates, please go here.

$().SPServices.SPRedirectWithID "Save & Close"

Nov 19, 2009 at 11:01 AM

Is there any possibility to reuse $().SPServices.SPRedirectWithID method to use it laike "Save & Close"?


Nov 19, 2009 at 12:53 PM

Can you explain a little more?


Nov 19, 2009 at 1:44 PM

I have some parent-child relation between lists. On entering a child item I want to add new parent. So I have used $().SPServices.SPLookupAddNew method to add new item, I modified it to open in new broser window (target="_blank"). This opens NewItem.aspx form in new window. So I need to fill the form and close the window.  OOB button in form is Save, but after save it can be redirected by default to "Allitems.aspx" or if I use $().SPServices.SPRedirectWithID it redirects to EditForm or other, but i do not need to redirect it, i just need to close it after save ("Save & close").

maybe you have more relevant solution for such operation?


Nov 19, 2009 at 2:15 PM
Edited Nov 19, 2009 at 2:18 PM


The behavior for the SPLookupAddNew function is to show a link on the original page that the user can click to add a new item to the lookup list.  When they save their addition to the list, they are taken back to the original page and the new lookup value is available in the dropdown. So, two thoughts:

  • Opening the SPLookupAddNew link in a new window is unnecessary
  • Even if you did close the new window, when the user got back to the original page, then new lookup value wouldn't be available until they refreshed the page

I'd stick with the SPLookupAddNew function as it is currently implemented.


Nov 19, 2009 at 4:42 PM
Edited Nov 19, 2009 at 4:47 PM


Thanks for your answer, in this case I'll stick to your suggestions, however I have one more case: i created some dashboard type webpartpage. which has a lot of links "add new item". I configured them to open in new window. So user adds a lot of new items but it leaves him a lot of open windows.

Maybe I should use links like this  http://mysite/web/Lists/MyList/NewForm.aspx?Source=pathtodashboard    mabe you have quick solution how to add to each "add new item" source parameter?

Or maby use some "Save & Close" in each form?


Nov 19, 2009 at 4:46 PM

It sounds like the same case to me, and my answer is pretty much the same. Each new window will work fine, but the original page will have to be refreshed to see any additions.


Nov 19, 2009 at 4:48 PM
Edited Nov 19, 2009 at 4:52 PM

I don't mind having refresh page, but I mind having a lot of new windows open. I thik I will stick to source parameter :) thanks anyway.

Nov 19, 2009 at 4:51 PM

Yes, use the Source parameter, and *don't* open new windows.


Nov 19, 2009 at 4:53 PM

Do you have any script which automaticaly appends source parameter to links?


Nov 19, 2009 at 5:09 PM

Just use:

"Source=" + location.href