Make a field required

rss

Posted by Hubbaroo - Jan 29 ’14 at 05:35

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

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 5 months 5 days
    #1 by Dmitry Kozlov Jan 30 ’14 at 02:32

    Hello,

    You can implement custom validation in onsubmit handler. Example:

    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
    Member
    Member for: 5 years 19 days
    #2 by mimmerfall Feb 4 ’15 at 07:13

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

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 5 months 5 days
    #3 by Dmitry Kozlov Feb 5 ’15 at 04:29

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

Displaying 1 to 3 of 3 messages