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,013 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
ID: 22738703
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
ID: 22739905
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Jquery GMAP3 Hierarchy 1 28
Sharepoint Online 5 33
Providing anonymous access to pdf form only - sharepoint 2013 9 27
Javascript the "if condition with Or" 8 17
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
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.

803 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