Change label field based on other field value

Good morning,
in my custom module I have the field ‘ABC’ and when filed ‘XYZ’ values 123 I would like to change ‘ABC’ into ‘DEF’.
Is it possible? if yes, how? I’m unable to find a solution :sob:

thank you
B.

Is the change just for display, in a particular view, or do you mean to change it in the database also?

I must change the label during edit view and detailview. I would like change only the label.

Maybe an override of the detail view class, like this one?

–> Calculate age from birthdate: override detail view example

And possibly you can work out something similar for edit view…

I forgot… For detailview, probably it can be a solution, but my problem is during editview: when i change the value for field ‘XYZ’ the lable of first field must change.

That sounds like you need to inject some Javascript to react to the change event and do those changes…

Yes, i have done this a few times, All you need is add JS to your Edit/Detail view and do the on change Text Change. Its pure JS nothing complicated or SuiteCRM related.

Check these samples:

https://www.techadv.com/blog/creating-onchange-and-onsave-events-sugarcrm

Thanks,

BrozTechnologies