Solved

Add a notification pop-up to a save or cancel button within a Data Form Web Part

Posted on 2008-10-15
2
1,005 Views
Last Modified: 2013-11-18
I have a need for a notification box to appear simply stating 'your submission has been received' when a user submits an item within a SharePoint Data Form Web Part.  Currently I redirect a user back to /default2.aspx which is an exact replica of /default.aspx except that I have added this script to /defaul2.aspx

<script type="text/javascript" language="JavaScript">

alert("Your Submission Has Been Received");

</script>

This accomplishes what I want, however if we make a change to default.aspx we also have to change default2.aspx, which we would rather not have to do.  Also I would like to see the popup before the redirect.  Is there some code that I could add to the input button onclick event to get an alert after the __commit and before the __redirect
<input type="button" value="Save" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={/default2.aspx}')}" />

Open in new window

0
Comment
Question by:DataBridge
2 Comments
 
LVL 6

Expert Comment

by:deiaccord
Comment Utility
You could try this

Add the below script which will display an alert before the update method is called. (based on an example here http://edinkapic.blogspot.com/2007/10/add-javascript-date-validation-into.html )

<script language="javascript" type="text/javascript">
function PreSaveAction()
{
    alert("Your update has been recieved");
    return true;  // OK to proceed with the save item
}
</script>



why does default2 need to be a copy of default however. Why not just direct them to a completely new page that just says your submission has been received with a link back to the main page?
0
 

Accepted Solution

by:
DataBridge earned 0 total points
Comment Utility
Well the thing is, my boss wanted to see the confirmation alert before the page was redirected, in other words, while the information that was input is still on the screen.  Anyway I did some playing around and stumbled across the syntax that got me exactly what I wanted.

<input type="button" value="Save" name="btnSave" onclick="javascript:alert('Your Submission Has Been Received');{ddwrt:GenFireServerEvent('__commit;__redirect={/}')}" />
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now