<div dir="ltr">Please find a little trick to make a calculated field in the same module<br>1. Create your field normally with the target format (text, integer etc...)<br>2. Edit the file /layouts/vlayout/modules/the_module_youhavecreatedyourfieldin/resources/Edit.js<br>3. Add in the file the code<br>This is an example code to calculate Age of a contact based on his birthday:<br>What I do, I hook the event change on the field triggering the calculation i.e Birthday<br>As
for the name of your custom field created in 1. open the page source of
the detail view of your module and you will find the field cf_XXX which
will be your target field or result of your calculation <br>I push the result of my calculation in my custom field<br>/**<br> * Function to calculate Age based on birthday field change<br> */ <br> jQuery('[name="birthday"]',form).change(function() {<br>
var dateBirth =
Vtiger_Helper_Js.getDateInstance(jQuery('[name="birthday"]',form).val(),jQuery('[name="birthday"]',form).attr("data-date-format"));<br> jQuery('[name="cf_755"]',form).val( Math.floor((Date.now()-dateBirth) / (31557600000)));<br> });<br><br>Happy Hacking<br><br><div><div class="gmail_signature">Christophe Humbert<br><br></div></div>
</div>