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

Nov 19, 2009 at 10:01 AM

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

 

Coordinator
Nov 19, 2009 at 11:53 AM

Can you explain a little more?

M.

Nov 19, 2009 at 12: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?

J.

Coordinator
Nov 19, 2009 at 1:15 PM
Edited Nov 19, 2009 at 1:18 PM

J.:

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.

M.

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

M.:

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?

J.

Coordinator
Nov 19, 2009 at 3: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.

M.

Nov 19, 2009 at 3:48 PM
Edited Nov 19, 2009 at 3: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.

Coordinator
Nov 19, 2009 at 3:51 PM

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

M.

Nov 19, 2009 at 3:53 PM

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

 

Coordinator
Nov 19, 2009 at 4:09 PM

Just use:

"Source=" + location.href

M.