views:

300

answers:

1

The issue I have is that people in my group are using a link to an Entry Form to post new itmes to a SharePoint list. Everytime they click 'submit' to post new item, SharPoint redirects them to the list. I need a solution for SharePoint to direct them to the empty Entry form instead, no matter how many times they need to use it. Is there such solution? Thanks,

I already have this "/EntryForm.aspx?Source=http://" in the link to the Entry form, but works only 2 times, after that will direct to the list.

+1  A: 

Essentially you need to ensure that the Source parameter is always set to EntryForm.aspx so that no matter how often you loop through the form you always get redirected back to a new one at the end. You knew this, but I am just clarifying!

Simplest method would be some javascript to test this source parameter and if its not what you want then redirect the request so it is.

If you can edit the EntryForm.aspx page in SharePoint Designer then add this javascript to the page somewhere:

<script type="text/javascript">

if (gup("ok") != 1) {
 if (gup("source") != window.location.href) {
  window.location = window.location.href + "?&source=" + window.location.href + "&ok=1";
 }
}

function gup( name ){  

 //This function returns the URL parameter specified
 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
 var regexS = "[\\?&]"+name+"=([^&#]*)";  
 var regex = new RegExp( regexS );  
 var results = regex.exec( window.location.href );  
 if( results == null )    
  return "";  
 else    
  return results[1];

}

</script>

Essentially this is just redirecting your requests to this page so the source is always itself. The ok parameter is just to ensure that it only does it once.

This is not perfect code, but it demonstrates the idea (and it works!)

gup (Get URL Parameter) function is taken from here and I find it really useful.

Hope it helps

Charlie

Charlie
Thanks Charlie,I will try your solution, but since I am new to SP and have no Java experience, what do I need to chance/add in this code?
Marius
Marius - This is simply javascript, but to add it you need to use SharePoint Designer which will allow you to edit list forms. Open EntryForm.aspx and at the top of the Content control using PlaceHolderMain enter my code sample. Once you have saved your form you should find that the form always redirects back to itself.
Charlie