Calculated Fields Form Blog

Tips and cases of use for a successful WordPress website with calculated forms.

Blog / "Calculated fields form" with no limits.

"Calculated fields form" with no limits.

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:

  • AnimeJS (JavaScript animation library with a simple, yet powerful API)
  • Chart.js (JavaScript charting for designers & developers)
  • Cleave.js (Formatting the contents of input tags while typing)
  • Formula.js (JavaScript implementation of most Microsoft Excel formula functions)
  • Leaflet (JavaScript library for mobile-friendly interactive maps)
  • Lodash (JavaScript utility library delivering modularity, performance & extras)
  • Math.js (Extensive math library)
  • MathJax (Display engine for mathematics)
  • Moment.js (Parse, validate, manipulate, and display dates and times in JavaScript)
  • Vocajs (JavaScript string library)

In addition, you can add new libraries to your collection via the menu option "Calculated fields form > Supplementary libraries":

Library list

Library list

Once populated the libraries collection, you can associate them with the forms via forms settings:

Form 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]);
})()