Page 1 of 1

Make a field required

Posted: 29 Jan 2014
by Hubbaroo
Can we make a field that is not required by the list required if a different field = Yes.

Re: Make a field required

Posted: 30 Jan 2014
by Dmitry Kozlov
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.

Re: Make a field required

Posted: 04 Feb 2015
by mimmerfall
Would this go in the OnClick property of the save button?

Re: Make a field required

Posted: 05 Feb 2015
by Dmitry Kozlov
No, you should put this code into JS-editor. Click JavaScript button on the ribbon of Forms Designer to open it.