Page 1 of 1

Confirmation Popup when saving

Posted: 20 Apr 2015
by Gregory Murillo
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,

Re: Confirmation Popup when saving

Posted: 21 Apr 2015
by Dmitry Kozlov
Hi,

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

http://spform.com/forms-designer- ... eld-values

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

Code: Select all

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;
});