Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor nick6352683

    (@nick6352683)

    I just checked one of my setups -it works on the front end for me…

    Xampp php 7.4.xx, WP 5.8.2, Latest version of ACF PRO (5.11.4) and many other plugins installed.

    If you open a support ticket, I can possibly help you make this work… (Clear Cache, disable plugins, change theme, etc…, your setup (ACF Field Group, custom php code, etc…).

    I can also produce a video proof that this thing currently works fine on the front end.

    Thread Starter wael_elsaid

    (@wael_elsaid)

    Hello Nick,
    I am using Advanced custom fields frontend pro to show the forms on the frontend and when used a calculated field in the form, it works from the backend correctly but on the frontend didn’t work and I have to go to the backend to update the post to be shown correctly on the frontend, and by the way, I found few users had the same problem here on the support posts exactly the same.

    Plugin Contributor nick6352683

    (@nick6352683)

    Yes you are correct that others have the same issues as you…, and if you look at the support threads early on when this plugin was first introduced, I had posted that this plugin was not working with Advanced Forms on the front end, but the calculations were correctly shown in the backsite.

    Unfortunately (and apparently) these third party ACF forms work and coded differently from ACF native forms. So you need to use it with ACF native forms if you want to see the calculations work on a front end form. The native ACF forms are very easy to make by the way, let me know if you need help with that..

    Look at the docs at:

    https://www.advancedcustomfields.com/resources/acf_form/ , and

    https://www.advancedcustomfields.com/resources/acf_form/

    The one that I use is a modified version of the “Create a specific post” example from the second link…

    Nick.

    Thread Starter wael_elsaid

    (@wael_elsaid)

    Thank you Nick for your reply and suggestions. Unfortunately, I can’t use the native ACF form as I needed in my form a repeater field to be populated and I don’t know how to use this kind of field with the native ACF forms on the frontend.

    Thread Starter wael_elsaid

    (@wael_elsaid)

    In fact, I solved this issue using Javascript to calculate the field value on the frontend on the runtime.

    Plugin Contributor nick6352683

    (@nick6352683)

    ACF Pro does all the work, even for Repeater fields, I do it all the time. Look at the “Create a specific post” example as IO mentioned above, and you will see how easy it is…

    Anyway, I’m glad you found a JavaScript solution for your issue… I hope if someone asks you can share your solution…

    Happy new year,
    Nick.

    Thread Starter wael_elsaid

    (@wael_elsaid)

    Thanks, Nick,
    In fact, I wanted to subtract a value of a repeater field from a normal number value so I fetched all the repeater subfields values and added them then subtract the result from the number value and assign this value to the calculated field value.

    <script>
                                            jQuery(document).ready(function($){
                                            
                                                let tamount = parseInt($("input#acff-post-field_61b0efb617650").val());
                                                let sum = 0;
                                                $("table.acf-table input[type=number]").each(function(){
                                                    sum += parseInt(+$(this).val());
                                                });
                                                let amountdue = tamount - sum ;
    
                                                $("div.acf-fields.acf-form-fields.-top > div.acf-field.acf-field-number.acf-field-61b0efca17651 > div.acf-input").text(amountdue);
                                               
                                              
                                            });
                                        </script>

    Best Regards,
    Wael

    Plugin Contributor nick6352683

    (@nick6352683)

    You are awesome in my book, thanks for sharing… I wonder if I can use it with Advanced Forms, making modifications to the code of course.

    Thanks a million,
    Nick.

    Thread Starter wael_elsaid

    (@wael_elsaid)

    Thanks, Nick,
    Yes, I think you can use it but of course, you will need some adjustments.

    Best Regards,
    Wael

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Good but not working on frontend’ is closed to new replies.