I need to populate a message or a display a dialog box when Save Button click triggers within my newform.aspx's PreSaveAction is called and redirect to allitems.aspx page for viewing the latest inserted item.

Is it possible through jQuery ?I am already referencing jquery 1.6.0 in my function and not used the jquery-UI plugins.

I know plugins are available for displaying the dialog box, but never used within SP 2010 environment.

I tried the below code, but somehow it didn't work.

if(flagGeneric == false)
  alert('please fill mandatory fields');
  return false;
 alert('Valdiations are done! Going to save the form ');
  var msg = "New Opportunity been created  successfully!";
  sec  = 10; 
  Notify(msg, sec)
 return true;

var  notifyId = null;
function Notify(msg, sec) {
notifyId = SP.UI.Notify.addNotification(msg, true);

 setTimeout(function () {
  notifyId = '';
 }, (sec == null ? 1500 : sec));
  • 1
    Do you wish to show an alert message when the user clicks Save button in newform.aspx? and redirect it to allitems.aspx? you may put alert in PreSaveAction and give return true. It will work Commented Oct 28, 2015 at 8:25
  • That helped me. Is it possible to show a dialog box with nice look and feel using jQuery?
    – samolpp2
    Commented Oct 28, 2015 at 8:48
  • one issue is that, i am having a detailed status column which is Enhanced rich text type field and when I tried to validate using jQuery , it didn't work and alert message popped up and SP's default mandatory error message being populated which is wrong in my case.Can you tell how to validate the enhanced rich text within the PreSaveAction call using js or jQuery?
    – samolpp2
    Commented Oct 28, 2015 at 8:50
  • 1
    the content from enhanced rich text field will be populated as HTML content. Convert the html content to normal text and try it. You will get JQuery to convert it. Commented Oct 28, 2015 at 9:05
  • I will open a new thread thnx.
    – samolpp2
    Commented Oct 28, 2015 at 9:07

1 Answer 1


To display an alert message with nice look and feel, you may create a page and show it in a SP.UI.ModalDialog within PreSaveAction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.