'SugarCRM validate fields before_save in Logic Hook

SugarCRM Versión: 7.6

In modules Cases, I have two custom field Reason and Subreason.

I want when Reason = Returns, Subreason must be required.

In the Edit page in Javascript the validate works, but in the list cases, in edit row, doesn't work.

I'm trying with a Logic Hook but nothing works

With

echo "Hi";
die();

The console returns

SyntaxError: Unexpected token H in JSON at position 0

SugarApplication::appendErrorMessage, not returns anything and Save

SugarApplication::redirect, returns error

SyntaxError: Unexpected token < in JSON at position 0

Any solution?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source