Answered by:
Add save button on content editor - error

Question
-
I added a save button - that save and redirect to a sublist - on a content web editor, but it is giving me an error and it will not save the changes or do any thing. my code is inside .txt file and linked:
<input type="button" name="btnSave" runat="server" value=" Save "
id="saveButton2" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={/Lists/Projects/AllItems.aspx}')}" />The error I get is:
SCRIPT5007: The value of the property 'GenFireServerEvent' is null or undefined, not a Function object
Any ideas. Thank you- Edited by FM250 Monday, May 13, 2013 9:17 PM
Monday, May 13, 2013 9:17 PM
Answers
-
I had to edit the form and add this line:
<input type="button" value=" Save/Add sub task " name="btnSave"
onclick="javascript: {ddwrt:GenFireServerEvent(concat('__commit;__redirect={/RM/Lists/Task/NewForm.aspx?PID=',/dsQueryResponse/Rows/Row/@ID,'}'))}"
- Marked as answer by FM250 Tuesday, May 21, 2013 8:59 PM
Tuesday, May 21, 2013 8:59 PM
All replies
-
"Content Web Part"? The Content Editor Web Part?
GenFireServerEvent is part of the Data View Web Part.
Mike Smith TechTrainingNotes.blogspot.com my SP customization book
Monday, May 13, 2013 9:46 PM -
I don't need a Data View. I just need an additional save/add child item which redirect to another page.
is there a simple way to do it. thanks
Monday, May 13, 2013 10:48 PM -
Tuesday, May 14, 2013 3:05 AM
-
Hi,
Just paste this is Content Edit Web part- Scource Editor
Edit URL as per your requirement and you are done..
Hope this helps
<div> <button type="button" class="btn">Redirect To other page</button> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $(".btn").click(function(){ var url= 'http://www.microsoft.com'; window.location.href = url; }); }); </script>
Regards,
Ankur
Tuesday, May 14, 2013 7:04 AM -
I had it like that, but it has to save before it redirects to another page. I have a presave function in the script and it sames to be the problem.
I had it where I customized the list and added my input save button working, but I needed the presave to validate the lookup field.
If I can find a way to validate the lookup field for the custom list from the designer then I can remove the script in the content editor and just use a code inside the list. Any ideas. thanks
- Edited by FM250 Tuesday, May 14, 2013 6:36 PM
Tuesday, May 14, 2013 6:26 PM -
I had to edit the form and add this line:
<input type="button" value=" Save/Add sub task " name="btnSave"
onclick="javascript: {ddwrt:GenFireServerEvent(concat('__commit;__redirect={/RM/Lists/Task/NewForm.aspx?PID=',/dsQueryResponse/Rows/Row/@ID,'}'))}"
- Marked as answer by FM250 Tuesday, May 21, 2013 8:59 PM
Tuesday, May 21, 2013 8:59 PM