• Resolved rod

    (@nomadarod)


    Hi,
    I have a html describing the prices when a certain product is selected additionally to the quantity. If I change the product selection and then return to the previous selection the calculations don’t show the correct results, except if I change quantity again or check one of the boxes. It happens only for the “Restant-Rabat”, “Restant-Rabat /3” and “Total” (calculations 10, 12 and 11) but not for “Inscriptions”(calculation 5). Similarly, the “Total à payer” disappears but only for some of the selections.
    I imagine it is a consequence of the “visibility” conditioning but I couldn’t find the cause and effect rule causing it.

    Is there a way to go around this, maybe forcing the “quantity” field or other fields to reset when selection is changed?

    With a fear that the user might send an unintended result to payment, I wondered also about the possibility to make the “continue” button inactive if certain conditions are not met.

    Thanks
    Rod

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @nomadarod,

    Just to be sure you are referring to the following form, right?

    Screenshot at 12:33:41.png

    I couldn’t find an option called “Restant-Rabat”, “Restant-Rabat /3″, so I’m a bit lost with where exactly to check those.

    Should I select any specific option under “Ateliers/Dates” to get the above options?

    Could you please share your form export so that we could have a better idea. Please check the following doc on how to export a form:
    https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export

    You can share the export file via Google Drive, Dropbox or any such cloud services in the following reply.

    We are looking forward to your response.

    Kind Regards,
    Nithin

    Thread Starter rod

    (@nomadarod)

    Hi Nithin,

    Yes, that’s the right form. Sorry, I wasn’t clear enough on the details. When I select the last option in “Ateliers” (C’est quoi manger sainement) and I add quantity, the values “Restant-Rabat” and “Restant-Rabat/3 become visible. If I chage selection in “Ateliers to a different option, the “Total à payer disapears and it comes back only if I change the quantity. If I go back to the option “C’est quoi manger sainement”, the calculation of Restant-Rabat and Restant-Rabat/3 show the value of the quantity instead of the whole calculation. I need to check one of the boxes or change the quantity for the right calculation to be made.

    Here is the export: https://pastebin.com/un3rkGcM

    Thank you for being there.
    Rod

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @nomadarod

    Thank you for the form.

    I am not sure if I could replicate the issue, when I switch the option and check the latest page it reflects the correct value:

    https://monosnap.com/file/85n8J17e7vDJpXxCwg2yKfPk46Zptc

    Let us know if we are missing anything.
    Best Regards
    Patrick Freitas

    Thread Starter rod

    (@nomadarod)

    Hi Patrick,
    Thank you for checking.

    Yes, you did replicate it as I get the same as you showed in the video:

    a) If I change selection in “Ateliers” to a different option, the “Total à payer” disappears and it comes back only if I change the quantity.

    This one is not so serious issue, but the next one, may induce some confusion and a sens of lack of competence or trust:
    b) If I go back to the option “C’est quoi manger sainement”, the calculation of Restant-Rabat and “Total” show the value of the quantity instead of the calculations. (They show the value “3” in the video: https://monosnap.com/file/tei0YKmTnDf3Py7y9LBwirDQhaBwDs . They were supposed to show “540” and “720”). If the user checks the box under the “Total à payer” so that he/she can pay the rest in 3 times, the “Restant-Rabat/3” calculation will give 180€/month during 3 months. But if I go back to a different option in the selector and then back to “C’est quoi manger sainement”, the “Restant-Rabat/3 calculation will tell them that they will pay 0.33 cents per month.

    I believe this is unlikely to happen but I can imagine a user prospecting the different options to see if the price is convenient and changing the selector back and forward to compare prices. I wonder how many will think that they may need to change the “quantity” field for the prices to give the right result?

    I would prefer if there is a way to go around this issue, maybe there is some “visibility” conditioning causing it? Or is there maybe a way to reset all the calculations when the user changes selector?

    I hope all this makes sense.
    Thank you for being there
    Rod

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @nomadarod

    I took a closer look again at the form and I could see both situations now.

    We escalated this situation to our Second Line Support team to verify if we can find any workaround to bypass this problem for you.

    We will keep you posted once hearing back from the developers.

    Best Regards
    Patrick Freitas

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @nomadarod,

    Could you please try the following snippet and then check whether it works fine?

    <?php
    
    add_action('wp_footer', 'wpmudev_fix_form_calculations', 9999);
    function wpmudev_fix_form_calculations(){
    	global $post;
    	if ( is_a( $post, 'WP_Post' ) && !has_shortcode($post->post_content, 'forminator_form') ) {
    		return;
    	}
    	?>
    	<script type="text/javascript">
    	jQuery(document).ready(function($){
    		$(document).on("after.load.forminator", function (e, id) {
    			if( id == 1791 ){
    				$('#select-1 select').on('select2:select', function() { 
    					setTimeout(function(){
    						$('#number-1 input').change();
    					},10);
    				});
    			}
    		});
    	});
    	</script>
    	<?php
    }

    You’ll need to edit the line in the above snippet ie;
    if( id == 1791 ){

    To your form ID, suppose your from ID is 123 then the above line will change to:
    if( id == 123 ){

    You can implement the above code as a mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Kind Regards,
    Nithin

    Thread Starter rod

    (@nomadarod)

    Hi Nithin,

    Thank you for the snippet. It worked great!

    Just one question: Does this plugin needs to be updated when all other plugins also do? How will I know when/how to manage it.

    cheers
    Rod

    Hello @nomadarod !

    Glad to hear the snippet worked for you!

    In this case there’s no real need to manage it in any way – it’s a separate snippet and it mostly uses a standard WordPress action to do the job. There should be no issue due to this.

    In some time you can check if the improvement has been patched in the plugin itself. To do that, rename the snippet so it doesn’t have a .php extension. If the issue is gone, you can either leave the mu-plugin renamed or remove the file completely. WordPress will only look for .php files in the mu-plugins folder. However, if you don’t do that, it should be fine as well.

    Kind regards,
    Pawel

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Automatically reset calculations’ is closed to new replies.