Save Message Dialog Box

Forums Dynamic Forms for SharePoint Save Message Dialog Box

This topic contains 7 replies, has 2 voices, and was last updated by  Kyle Vaske 4 years, 5 months ago.

  • Author
    Posts
  • #6629

    Kyle Vaske
    Participant

    Is there a way to have a dialog box appear that will have a Yes/No checkbox option when the Save button is clicked? For example, when they click Save, an Alert will appear saying “Is this form Complete or still In Progress?”, the user would then have to select one of the options in order for the save to process?

  • #6648

    Alexander Bautz
    Keymaster

    Add this code to the Custom JS section:

    function dffs_PreSaveAction(){
    	if(!confirm("Save the form?")){
    		return false;
    	}
    }

    Alexander

  • #6661

    Kyle Vaske
    Participant

    Sorry I may not have clarified well enough. The form is something they fill out continuously throughout their shifts. What they are asking for is a Pre-Save, and Final-Save. So when they click the normal Save button, the dialog box would appear asking “Is this form Complete or still In Progress?” If “In Progress”, it would mark a Save Status (choice column with options of “Complete” or “In Progress”) field as In Progress. They can then open the form back up and fill out until they mark it as Completed, which will then trigger an alert.

    So basically, I need to show a regular List choice column within the dialog box when they press save.

    Is this possible?

  • #6707

    Alexander Bautz
    Keymaster

    Sorry for the delay. This is not possible without custom making a dialog. In the example you have an ok or cancel button, and you can use them to set a field value for OK and another for Cancel. Here is an example on how to set the value:

    setFieldValue("FieldNameHere","value you want to set");

    Hope this helps,
    Alexander

  • #6709

    Kyle Vaske
    Participant

    Would it be possible to add another button to the dialog box at the bottom that would accomplish this functionality then? So next to the default “Save” and “Cancel” buttons, there would be another button that would be “Final Save”. The “Final Save” button would have the exact same functionality as the normal “Save”, but it would also change an additional Choice column (titled “Final Save”) to “Completed”.

    Is this possible?

  • #6714

    Alexander Bautz
    Keymaster

    This is possible. Add this code to the custon JS in the Misc tab:

    (function(){
    	var b = [""];
    	b.push("<td class='ms-toolbar' nowrap='nowrap'>");
    	b.push("<input type='button' class='ms-ButtonHeightWidth' value='Final save' onclick='finalSave();' />");
    	b.push("</td>"); 
    	b.push("<td class='ms-separator'> </td>");
    	$("input[id$=diidIOSaveItem]:last").parents("table:first").parents("td:first").before(b.join(""));
    })();
    
    function finalSave(){
    	setFieldValue("YourFieldInternalName","Completed");
    	$("input[id$=diidIOSaveItem]:last").click();
    }

    You must change the “YourFieldInternalName” in the finalSave function.

    Alexander

  • #6718

    Kyle Vaske
    Participant
    
    
    (function(){
    	var b = [""];
    	b.push("<td class='ms-toolbar' nowrap='nowrap'>");
    	b.push("<input type='button' class='ms-ButtonHeightWidth' value='Final Save' onclick='finalSave();' />");
    	b.push("</td>"); 
    	b.push("<td class='ms-separator'>&nbsp;</td>");
    	$("input[id$=diidIOSaveItem]:last").parents("table:first").parents("td:first").before(b.join(""));
    })();
    
    function finalSave(){
    	setFieldValue("FinalSave","Completed");
    	$("input[id$=diidIOSaveItem]:last").click();
    }

    I have added this to the Custom JS and attached is what it displays on the screen.

    Attachments:
  • #6721

    Kyle Vaske
    Participant

    Sorry, I got it to work now. Thank you for all your help!

You must be logged in to reply to this topic.