Tips and cases of use for a successful WordPress website with calculated forms.
Extending the "Calculated Fields Form" plugin to be used in any imaginable project.
The "Calculated Fields Form" plugin stands out for the number of operations it includes. Mathematical operations, financial operations, distance calculation, URL parsing and more. However, there are areas where these operations are not enough. Such as in engineering with polynomial calculations, mathematicians who need to evaluate operations with matrices or complex numbers, economists who require advanced Excel functions, or developers who are familiar with third-party libraries or their own libraries.
For all these advanced users, we just released the "Complementary Libraries for Calculated Fields Form" plugin:
https://cff-bundles.dwbooster.com/product/complementary-libraries
The "Complementary Libraries" plugin allows using third-party libraries and APIs with the CFF forms. The plugin includes some predefined libraries you can select from form settings, but it is possible to add new libraries or edit the existing ones.
The "Complementary Libraries" plugin includes the predefined libraries:
In addition, you can add new libraries to your collection via the menu option "Calculated fields form > Supplementary libraries":
Once populated the libraries collection, you can associate them with the forms via forms settings:
And use their operations from the calculated fields' equations.
For example, assuming you selected the Moment.JS library through form settings, you could implement equations that use moment methods such as:
moment().format("[Today is] dddd");
Whose output would have the format:
Today is Monday
To get the same result without the Moment.JS library would require a complex equation:
(function(){
var date = TODAY(),
week_day = WEEKDAY(date),
days = {1:'Sunday',
2:'Monday',
3:'Tuesday',
4:'Wednesday',
5:'Thursday',
6:'Friday',
7:'Saturday'
};
return CONCATENATE('Today is ', days[week_day]);
})()