Confirmation Popup when saving

rss

Posted by gteccr - Apr 20 ’15 at 11:44

Hello, I have this scenario:

2 Required Fields (Set as required in SharePoint List)

2 Fields that may be required based on another field value.

What I need is that once I hit the Save button, to show a Popup telling the user the Item was saved successfully. This is the code I have for the validation:

var main_field = fd.field('RequestType);

fd.onsubmit(function () {

if (main_field.value() == 'Type1') {

if (!fd.field('Address').value()) {

alert('Please, fill in the Address field.');

return false;

} else if (!fd.field('Mobile').value()) {

alert('Please, fill in the Mobile field.');

return false;

}

}

return true;

});

 

Regards,

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 20 days
    #1 by Dmitry Kozlov Apr 21 ’15 at 05:53

    Hi,

    Please, specify types of RequestType, Address, and Mobile fields. Ensure that you use right code to get their values:

    http://formsdesigner.blogspot.com/2013/04/getting-and-setting-sharepoint-form.html

    Also you can output variables to make sure that their values are correct:

    var main_field = fd.field('RequestType);
    fd.onsubmit(function () {
    	alert(main_field.value());
    	if (main_field.value() == 'Type1') {
    		alert(fd.field('Address').value());
    		alert(fd.field('Mobile').value());
    		if (!fd.field('Address').value()) {
    			alert('Please, fill in the Address field.');
    			return false;
    		} else if (!fd.field('Mobile').value()) {
    			alert('Please, fill in the Mobile field.');
    			return false;
    		}
    	}
    
    	return true;
    });
    
Displaying 1 to 1 of 1 messages