Dynamically make a field required based on another field - Dinamic Field Validation

Hi

I need to dynamically make a field required based on another field input.

Example: while creating/editting an “Account” if user fills the “City” field, the “Country” field becomes mandatory. So he cannot save the account until “Country” is filled.
(If City is not empty Country is required).

Thanks in advance

Anything dynamic like that needs to use javascript. You can Google for stuff like “inject javascript into detail view”, or list view, etc.

Remember anything relative to SugarCRM up to version 6.5 is also worth checking out.

Hi,
You can use AddtoValidate to make a field required
and
RemoveFromValidate to make a field optional by using jquery on field change event trigger.
i.e when city field change event triggers and that is not empty
AddtoValidate the Country else Remove it from Validate.

This link can help you.

https://suitecrm.com/suitecrm/forum/developer-help/6921-viewedit-validation

Thanks