Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm looking to create a popup dialogue box when a column called 'Status' is set to 'Complete'. I want a popup box to ask "Confirm Complete?" with Yes or Cancel choices. Obviously Yes will update the record with Status Complete (which I have applied a filter already working to show the record in an "Archived" view, and again obviously, Cancel will cancel the changes.

Is this possible?

thanks...

share|improve this question
    
I guess you want to do that in the edit form, am I right? –  MdMazzotti Mar 5 at 9:36
    
Yes, that's correct. I've set the list settings so that the edit form doesn't launch in a dialogue. –  daryl Mar 5 at 9:55

1 Answer 1

You can hook into the PreSaveAction function and put your verification logic in here.

For example:

function PreSaveAction(){
  if($('select[title="Status"]').val() == "Completed"){
     var isConfirmed = confirm("Do you confirm task completion?");
     if (isConfirmed ) return true; //confirm changes
     $('input[name$="IOGoBack"]').click(); //cancel changes
  }
  return true;
}

For this you'll need jQuery. And as a side note, the selector based on title attribute can easily break in a multi-language site (because, if you change the display language, the title will change accordingly).

Update: I edited the function so that if the confirmation dialog returns false, the Cancel button click is triggered

share|improve this answer
    
Thanks for that, however, is there perhaps something I'm missing, perhaps format-wise, as when I go to Edit HTML source, the above code actually shows as text instead of becoming background code. –  daryl Mar 5 at 10:06
    
The best thing would be to edit the page in SPDesigner and put the code inside a <script> tag at the bottom of the page. Or, you can add a CEWP to the page, from the web UI, and link to an existing js file that you'll have created and put inside a doc library of your choice –  MdMazzotti Mar 5 at 10:09
    
I'm unable to use SPDesigner, the company does not allow us to use this. I've entered the line [code]<script type="text/javascript">[/code] in and this now sets it as code, however, I'm receiving an error with details... Message: Object expected Line: 696 Char: 3 Code: 0 –  daryl Mar 5 at 10:11
    
OK, so the CEWP is your plan B –  MdMazzotti Mar 5 at 10:12
    
If you have got SP 2013, you can also use script editor webpart. –  Nadeem Yousuf Mar 5 at 10:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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