Support

Account

Home Forums ACF PRO "Placeholder" Field to calculate?

Helping

"Placeholder" Field to calculate?

  • Hi there,

    is it possible to create an “placeholder” field in which can be values written?

    For example:
    I want to create some “ranking” fields..
    1. Design
    2. Speed

    now i can use these fields to create an average ranking like:

    
    $field_1 = get_field('design');
    $field_2 = get_field('speed');
    $total = ($field_1 + $field_2) / 2;
    

    But i want to use a ACF in the backend for the $total variable.

    I hope it is conceivable what I mean.

    THX ๐Ÿ™‚

  • Yes, something like this can be done.

    You have 2 choices. The first is the easiest. Us an acf/load_value filter on your place holder field. Get the values from the other 2 fields, if they exists, an do the calculation and return the result.

    The second would be to create custom JavaScript to populate the field without doing a page load. You’d need to do some more research on this. You can start here: http://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.