Make field required

Hi, I have created a form, from a list (call it List1) that includes a data source from a separate library (Library1). I need to make a field in Library1 a required field (Choices1). The data source name for Library1 is SPDataTable1.

I have the following code, but the user is not being prompted to fill in Choices1 in Library1:

fd.spRendered(function() {

//makes a field required
fd.field('Choices1').required = true;
})

});

How do I make Choices1 in SPDataTable1 a required field?

Dear @lzaf,
You can go to Library1, open Library Settings, select Choices1 column and make it required.

Or you can use the following code:

fd.spRendered(function() {
    fd.control('SPDataTable1').$on('edit', function(editData) {
        if (editData.formType === 'New' || editData.formType === 'Edit') {
            editData.field('Choices1').required = true;
        } 
   });
});