Make a field required

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

29 Jan 2014

Can we make a field that is not required by the list required if a different field = Yes.

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

30 Jan 2014

Hello,

You can implement custom validation in onsubmit handler. Example:

Code: Select all

fd.onsubmit(function() {
	if (fd.field('YesNo').value() && !fd.field('Title').value()) {
		alert('Please, fill in Title field.');
		return false;
	}
	
	return true;
});
In my sample, since YesNo checkbox is selected, Title field become required.

mimmerfall
Posts: 1
Joined: Wed Feb 04, 2015

04 Feb 2015

Would this go in the OnClick property of the save button?

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

05 Feb 2015

No, you should put this code into JS-editor. Click JavaScript button on the ribbon of Forms Designer to open it.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests