Make the relationship mandatory in a custom module


I have Suitecrm 7.11.1.
I have a standard module1, and a custom Module2.
I have a one to many relationship between Module1 (one) and Module2 (many).

I need to make the relationship mandatory from Module2, so when I create a record in Module2 I’m forced to enter a Module1 record.

I understand it’s not feasible from the standard interface, does somebody know how to change the code to make it?

thank you,


I don’t know exactly how to do it, but I would start from code samples using Javascript injection into the view, to make validations.

Like these

Field validation with simple callback from vardefs: