Yukesh Kumar

Yukesh Kumar

  • NA
  • 19
  • 1k

Saving data but not redirecting to my main page

May 21 2018 1:19 AM
Dear Friends,
 
Please help me on this issue.
 
i have written code with custom save button.
 
The issue is
 
My data is saved but its not redirecting to overall list on saving.
  1. function SaveToArchive()  
  2. {  
  3. createListItem(Old_Comments,Old_Status,Old_CommitedDate_Return,FileId);  
  4.   
  5. }  
  6. var clientContext;  
  7. var oListItem;  
  8. var itemId;  
  9. var oList;  
  10. function createListItem(Comments,Status,DateOR,FileId) {  
  11. clientContext = new SP.ClientContext.get_current();  
  12. oList = clientContext.get_web().get_lists().getByTitle('Archival-Bus PD');  
  13. var itemCreateInfo = new SP.ListItemCreationInformation();  
  14. this.oListItem = oList.addItem(itemCreateInfo);  
  15. debugger;  
  16. oListItem.set_item('', Comments);  
  17. oListItem.set_item('', Status);  
  18. oListItem.set_item('', DateOR);  
  19. oListItem.set_item('', FileId);  
  20. oListItem.update();  
  21. clientContext.load(oListItem);  
  22. clientContext.executeQueryAsync(  
  23. Function.createDelegate(thisthis.onQueryInsertSucceeded),  
  24. Function.createDelegate(thisthis.onQueryInsertFailed));  
  25. }  
  26. function onQueryInsertSucceeded() {  
  27. alert('Archived Success!');  
  28. if (!PreSaveItem()) return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl40$g_dce98914_9b55_4959_a1ce_16d74ab6f672$savebutton2$ctl00$diidIOSaveItem"""true""""falsetrue))  
  29. }  
  30. function onQueryInsertFailed() {  
  31. alert("Archive Failed");  
  32. } 
  1. </table>  
  2. </span>  
  3. <SharePoint:AttachmentUpload runat="server" ControlMode="Edit"/>  
  4. <SharePoint:ItemHiddenVersion runat="server" ControlMode="Edit"/>  
  5. </div>  
  6. </xsl:template>  
  7. <xsl:template name="dvt_1.body">  
  8. <xsl:param name="Rows"/>  
  9. <tr>  
  10. <td class="ms-toolbar" nowrap="nowrap">  
  11.   
  12. </td>  
  13. </tr>  
  14. <tr>  
  15. <td class="ms-toolbar" nowrap="nowrap">  
  16. <SharePoint:FormToolBar runat="server" ControlMode="Edit"/>  
  17. <SharePoint:ItemValidationFailedMessage runat="server" ControlMode="Edit"/>  
  18. </td>  
  19. </tr>  
  20. <xsl:for-each select="$Rows">  
  21. <xsl:call-template name="dvt_1.rowedit"/>  
  22. </xsl:for-each>  
  23. <tr>  
  24. <td class="ms-toolbar" nowrap="nowrap">  
  25. <table>  
  26. <tr>  
  27. <td class="ms-descriptiontext" nowrap="nowrap">  
  28. <SharePoint:CreatedModifiedInfo ControlMode="Edit" runat="server"/>  
  29. </td>  
  30. <td width="99%" class="ms-toolbar" nowrap="nowrap"><IMG SRC="/_layouts/15/images/blank.gif" width="1" height="18"/></td>  
  31. <td class="ms-toolbar" nowrap="nowrap">  
  32. <input type="button" id="btnSave" value="Save" onclick="SaveToArchive()"></input>  
DATA GETS SAVED BUT NOT REDIRECTING TO OVERALL LIST.

Answers (7)