WordPress.org

Forums

Calculated Fields Form
[resolved] concatenate in calculated field (2 posts)

  1. fitlicious
    Member
    Posted 10 months ago #

    Sorry. Another newbie question.

    Can you concatenate text with a calculated field? If so, how?

    https://wordpress.org/plugins/calculated-fields-form/

  2. codepeople
    Member
    Plugin Author

    Posted 10 months ago #

    Hi,

    The calculated fields are used to display numeric values, resulting of mathematical equations , furthermore the plugin tries to extract the numbers from the values of fields used in the equations.

    If you want use the calculated fields to concatenate texts, you should change a little the plugin code.

    First, if your equation is fieldname1+fieldname2, I recommend modify it like follow: fieldname1+''+fieldname2 to be sure the values of fieldname1 and fieldname2 are treated as texts.

    Second, opens the module_public.js file, located in "/wp-content/plugins/calculated-fields-form/js/modules/01_mathematical_logical/public/module_public.js", with the text editor your choice, and modifies the snippet of code:

    return isFinite( v ) || /\d{2}[\/\-\.]\d{2}[\/\-\.]\d{4}/.test( v );

    like follow:

    return (typeof v != 'undefined');

    Best regards.

Reply

You must log in to post.

About this Plugin

  • Calculated Fields Form
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.