Confirmation Popup when saving

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
Gregory Murillo
Posts: 8
Joined: Wed Jun 17, 2015

20 Apr 2015

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,

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

21 Apr 2015

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests