Calc Builder Support

Calc Builder support
No se permite escribir sin estar logado. Por favor, login

Javascript events cb_setValue 04.11.2015 11:20


I am not understanding Javascript events: cb_getValue and cb_setValue, or at least not observing what I expected. I need to do calculations, but just for testing purposes, consider

averageSalary (Type: Number)
benefits (Type: Number)
annualSalary (Type: Number)
monthlySalary (Type: Number)

Javascript events, Executed before calculate execution

//Get Value from Field
//var result=cb_getValue('myvar');
var averageSalaryResult=cb_getValue('averageSalary');
var benefitsResult=cb_getValue('benefits');

//Set Value from Field

When I enter a number in averageSalary and benefits, I expected to see the numbers in fields annualSalary and monthlySalary. However, the text "averageSalaryResult" and "benefitsResult" is shown.

Re: Javascript events cb_setValue 04.11.2015 13:23

at your code you're getting the values of the two fields, and then setting a new values for the other fields. As you're using


you're setting a fixed text 'averageSalaryResult' to that input. In case you want to use the value you have just recovered from the other field, use without '':


For setting 'result' values inside the input form, you can follow other different approach as well, using inline fields:

- Change the type of the destination fields from 'text' to 'inline result'
- Now at the code section (the main php code, not the js tabs), you can set your calculated value to that fields, for ex:


This will change 'annualSalary' value each time user changes values at the form.

Hope this helps, please let us know if you need further help with this.

Moonsoft Team
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Lo que nuestros clientes opinan de nosotros